0

当我使用参数时,我一直被告知我的 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函数。

在此先感谢您的帮助。

4

1 回答 1

0

使用?param 语法

Dim sql As String = "select firstname, password from users where email = ?email"
于 2012-08-15T10:29:42.533 回答