目前的进度迈向SOLUTION:插入命令OLE参数
这是更新的代码:
sql = "INSERT INTO Strings (String_Name, Long_Text, Short_Text, Alternate_Text, Multi_String_ID, Lang_ID) VALUES (?,?, ?,?,?,?)"
Dim command = New OleDbCommand(sql, pConn)
command.Parameters.AddWithValue("@webStringName", "String_Name")
command.Parameters.AddWithValue("@webLang_String", "Long_Text")
command.Parameters.AddWithValue("@ptsShortText", "Short_Text")
command.Parameters.AddWithValue("@webAltText", "Alternate_Text")
command.Parameters.AddWithValue("@webMultiStringID", "Multi_String_ID")
改变上述行来这... command.Parameters.AddWithValue( “@ webMultiStringID”,OleDbType .Integer)。价值= webMultiStringID
command.Parameters.AddWithValue("@webLang_Code", "Lang_ID")
command.ExecuteNonQuery()
ORIG POST:
我正在尝试使用和OLE适配器创建和INSERT语句。我没有paramtersm工作,但现在我正在尝试添加parms,并且遇到了语法问题。哈
这里是到目前为止的代码...
command = New OleDbCommand(sql, pConn)
sql = "INSERT INTO Strings (String_Name, Long_Text, Short_Text) VALUES (?,?, """ & ptsShortText & """)"
command.Parameters.Add("@webStringName", OleDbType.VarChar, 250, "String_Name")
command.Parameters.Add("@webLang_String", OleDbType.VarChar, 250, "Long_Text")
command = New OleDbCommand(sql, pConn)
command.ExecuteNonQuery()
只是试图让前两个变量参数。
任何建议将不胜感激。
编辑:固定SQL
为什么不走一路和参数所有三个参数... – 2012-02-06 17:50:03