开发者

VB.net OLE DB error

I am getting this error on the excecuteNonQuery line:

Characters found after end of SQL statement.

My code:

deleteObj.CommandText = "UPDATE STUDENTS SET std_name = @name where std_id 开发者_如何学Python= @id; UPDATE BALANCE SET Amount= @amount where std_id=@id"

deleteObj.Parameters.AddWithValue("@name", txtboxName.Text)
deleteObj.Parameters.AddWithValue("@id", ComboBox1.SelectedItem)
deleteObj.Parameters.AddWithValue("@amount", txtboxBalance.Text)

objConnection.Open()
deleteObj.ExecuteNonQuery()
objConnection.Close()


I'd reconsider your use of data types, but the answer to your question is that you probably need another semi-colon on the end of your second update statement.

if your using oledb, check the provider you are using accepts named parameters AND that it'll allow you to use multiple queries in one command.


You should use like this

deleteObj.CommandText = "UPDATE STUDENTS SET [std_name] = @name where std_id = @id; UPDATE BALANCE SET [Amount]= @amount where std_id=@ id"

for example

use [Fielddname] :D
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜