当我使用参数时,我不断被告知我的mysql语法中存在错误。
这是我的代码:
Dim db As New Database
Dim sql As String = "select firstname, password from users where email = :email"
Dim args As New List(Of MySqlParameter)
args.Add(New MySqlParameter(":email", txtEmail.Text))
' execDB(procedurename As String, proceduretype As String, parameters() as MySqlParameter, returntype As String, newconnection As Boolean)
Dim dr As MySqlDataReader = db.execDB(sql, "Text", args.ToArray, "DataReader", False)
错误指出:email
不是有效值。我不明白为什么它没有使用参数,因为我将它传递给execDB
函数。
提前感谢您的帮助。
答案 0 :(得分:0)
使用?param
syntax,
Dim sql As String = "select firstname, password from users where email = ?email"