【发布时间】:2020-05-06 20:57:16
【问题描述】:
刚刚编辑了这个子程序,所以我现在可以保存语言和字体的值。
以前它工作得很好,但现在它给我一个 sql 字符串的语法错误。
Sub insertuservalues(conn, a, b, c, d, e, f)
Dim sql As String = "INSERT INTO tblUserDetails(Name,Username,[Password],Email,Language,Font) VALUES (@name, @username, @password, @email, @language, @font)"
Using connection As New OleDbConnection(conn)
Using command As New OleDbCommand(sql, connection)
connection.Open()
command.Parameters.Add("@name", OleDbType.VarWChar).Value = a
command.Parameters.Add("@username", OleDbType.VarWChar).Value = b
command.Parameters.Add("@password", OleDbType.VarWChar).Value = c
command.Parameters.Add("@email", OleDbType.VarWChar).Value = d
command.Parameters.Add("@language", OleDbType.VarWChar).Value = e
command.Parameters.Add("@font", OleDbType.VarWChar).Value = f
command.ExecuteNonQuery()
connection.Close()
End Using
End Using
End Sub
字段Language 和Font 已添加到表中,并且所有传递的变量都有一个有效值。为什么会这样?
【问题讨论】: