I have a code that connects to MYSQL database for querying, but it doesn't work. I don't know where I wrote it wrong. I'm seeking advice!
Private Sub EditText2_EnterPressed'比对结果
Dim zw As String
Dim bt As String
Dim cx As String
Dim nm As String
MysqlJdbc.InitializeAsync("EventMysql", driver, jdbcUrl, Username, Password)'重新连接
Wait For EventMysql_Ready (Success As Boolean)
If Success = False Then
ToastMessageShow("数据库连接失败,请检查",True)
Else'开始进行查找比对
cx=Button3.Text'程序名
zw=EditText1.text'站位
bt=EditText2.text'物料条码
Dim Cursor As JdbcResultSet
Cursor =MysqlJdbc.ExecQuery($"SELECT sys FROM smt WHERE 程序名='${cx}' and 站位='${zw}'"$) '查询结果
Do While Cursor.NextRow
nm=Cursor.GetString("物料编码")
If nm<>"" Then
If nm=bt Then
Label3.text="OK"
Else
Label3.text="NG"
End If
End If
Loop
' ToastMessageShow(zw,True)
MysqlJdbc.Close
End If
End Sub
I have a code that connects to MYSQL database for querying, but it doesn't work. I don't know where I wrote it wrong. I'm seeking advice!
Private Sub EditText2_EnterPressed'比对结果
Dim zw As String
Dim bt As String
Dim cx As String
Dim nm As String
MysqlJdbc.InitializeAsync("EventMysql", driver, jdbcUrl, Username, Password)'重新连接
Wait For EventMysql_Ready (Success As Boolean)
If Success = False Then
ToastMessageShow("数据库连接失败,请检查",True)
Else'开始进行查找比对
cx=Button3.Text'程序名
zw=EditText1.text'站位
bt=EditText2.text'物料条码
Dim Cursor As JdbcResultSet
Cursor =MysqlJdbc.ExecQuery($"SELECT sys FROM smt WHERE 程序名='${cx}' and 站位='${zw}'"$) '查询结果
Do While Cursor.NextRow
nm=Cursor.GetString("物料编码")
If nm<>"" Then
If nm=bt Then
Label3.text="OK"
Else
Label3.text="NG"
End If
End If
Loop
' ToastMessageShow(zw,True)
MysqlJdbc.Close
End If
End Sub