Reputation: 13
This is my final Graduation Project and I am stuck on this. Using:
I have checked the registry and its fine. Insert is working on other places.
Can anyone please help?
Public Sub insertreply()
Dim con1 As New OleDbConnection
con1.ConnectionString = constr
Dim cmd As New OleDbCommand
Dim strsql As String
con1.Open()
cmd.Connection = con1
strsql = "Insert Into replyblog("
strsql &= "repliername"
strsql &= ",replierprofilepicture"
strsql &= ",replierreply"
strsql &= ",replieruniversity"
strsql &= ",repliertoid"
strsql &= ",replierid"
strsql &= ",replierthanks"
strsql &= ",repliermajor"
strsql &= ",repliergrad"
strsql &= ",replierthanked) "
strsql &= "Values("
strsql &= "@repliername"
strsql &= ",@replierprofilepicture"
strsql &= ",@replierreply"
strsql &= ",@replieruniversity"
strsql &= ",@repliertoid"
strsql &= ",@replierid"
strsql &= ",@replierthanks"
strsql &= ",@repliermajor"
strsql &= ",@repliergrad"
strsql &= ",@replierthanked)"
cmd.CommandText = strsql
cmd.Parameters.AddWithValue("@repliername", lblrepliernamen.Text)
cmd.Parameters.AddWithValue("@replierprofilepicture", lblreplierpicn.text)
cmd.Parameters.AddWithValue("@replierreply", tbxinfo.Text)
cmd.Parameters.AddWithValue("@replieruniversity", lblreplieruniversityn.text)
cmd.Parameters.AddWithValue("@repliertoid", Session("QuestID"))
cmd.Parameters.AddWithValue("@replierid", lblreplieridn.Text)
cmd.Parameters.AddWithValue("@replierthanks", lblreplierthanksn.Text)
cmd.Parameters.AddWithValue("@repliermajor", lblrepliermajorn)
cmd.Parameters.AddWithValue("@repliergrad", lblrepliergradn.text)
cmd.Parameters.AddWithValue("@replierthanked", "n")
cmd.ExecuteNonQuery()
con1.Close()
End Sub
I am having the error on cmd.executeNonQuery()
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
Upvotes: 1
Views: 1269
Reputation:
The error means that there's an issue with your SQL. You're also attempting to put a label without the Text
property into one of your parameters:
cmd.Parameters.AddWithValue("@repliermajor", lblrepliermajorn)
...should be...
cmd.Parameters.AddWithValue("@repliermajor", lblrepliermajorn.Text)
(Though this may not be the answer).
Upvotes: 1