No value given for one or more parameters

prakash77

Active member
Joined
Mar 12, 2010
Messages
29
Programming Experience
Beginner
hi friends,

when i going to update a database it shows an exception that like "NO VALUE GIVEN FOR ONE OR MORE PARAMETERS" what will be the problem? i

if anyone knows pls tell me frnds...

thanks in advance...
 
here s t corresponding code....

con.Open()
Dim cmd As New OleDbCommand("update bookdetails set bookid = " & TextBox2.Text & " AND bookname ='" & TextBox3.Text & "' AND authorName ='" & TextBox4.Text & "' AND [publisher Name] ='" & TextBox5.Text & "' AND category ='" & ComboBox1.Text & "' AND price=" & TextBox6.Text & " AND totalcopies =" & TextBox7.Text & " AND available=" & TextBox8.Text & " where sno =" & TextBox1.Text & ";", con)
cmd.ExecuteNonQuery()
MsgBox("Record Updated", MsgBoxStyle.Information, "INFORMATION")

any mistake in this frnds...pls help me.....
 
Don't use string concatenation to build SQL code. Always use parameters. If you do so here then your issue will likely go away. Follow the Blog link in my signature and check out my post on ADO.NET Parameters.
 
On a separate note, give the names of items on the form something more meaningful so when it gets more complex or you re-visit the code it makes more sense.

e.g.

bookname = TextBox3.Text

Try:-

bookname = bookname.Text

I appreciate you may of planned on tidying it up once you got it working, if this is the case just ignore me as I know nothing!! :)
 

Latest posts

Back
Top