我想根據所需用戶的值顯示數據,我嘗試使用包含輸入值的參數。當我運行程序時數據無法執行。我試圖找到我的故障位置代碼,通過檢查保存來自用戶輸入結果的limit_kar的值是輸入的相應結果的內容,當存儲到參數中的limit_kar值更改爲0時,我想了很多錯誤,在我的代碼,請提示問題這個可以我使用VS 2008和MySQL解決值參數更改爲0
謝謝
新手
這是mycode的
Public Function Tampil_Stock(ByVal limit_kar As Integer) As List(Of Class_stock)
Dim tmpBaca As New List(Of Class_stock)
Dim cmd As New MySqlCommand
Dim dreader As MySqlDataReader
Dim ds As New DataSet
Dim sql As String
sql = "SELECT NoReg,status_kartu FROM tb_stock WHERE status= '0' and status_kartu= '0' ORDER BY NoReg ASC Limit ?fn "
cmd = New MySqlCommand(sql, myconnection.open)
cmd.Parameters.Add(New MySqlParameter("?fn", MySqlDbType.Int64)).Value = **limit_kar**
dreader = cmd.ExecuteReader
If dreader.HasRows Then
While dreader.Read
Dim objTemp As New Class_stock
objTemp.NoReg_ = dreader.Item("NoReg")
'objTemp.NoPin_ = dreader.Item("NoPin")
'objTemp.status_ = dreader.Item("status")
objTemp.status_kartu_ = dreader.Item("status_kartu")
tmpBaca.Add(objTemp)
End While
Else
MsgBox("Not Found")
End If
myconnection.close()
Return tmpBaca
'dreader.Close()
End Function
** ** limit_kar變化總是0 – user2453977
認沽斷點在此行'公共功能Tampil_Stock(BYVAL limit_kar爲整數)作爲目錄(中Class_stock)'和檢查值 –