7 Replies - 1341 Views - Last Post: 08 August 2012 - 05:54 PM
#1
no value given for one or more required parameters vb6
Posted 06 August 2012 - 06:47 PM
Please someone help me with this. I can't save the data into database. Error :"no value given for one or more required parameters" keep coming. Below is the screenshot. Thank you in advance.
Replies To: no value given for one or more required parameters vb6
#2
Re: no value given for one or more required parameters vb6
Posted 06 August 2012 - 07:32 PM
p/s this is the real sample code. Please what is wrong with this coding. 
con.Execute ("insert into Questions values('" + combosubject.Text + "'," + txtsbcode.Text + _
",'" + Text1.Text + "','" + txtq.Text + _
"','" + opt1.Text + "','" + opt2.Text + _
"','" + opt3.Text + "','" + opt4.Text + "','" + real.Text + "')")
#3
Re: no value given for one or more required parameters vb6
Posted 06 August 2012 - 11:51 PM
Are you specifying all columns in your query?
If not you need to change your syntax to specify the columns.
INSERT INTO TABLE_NAME (column1, column2, column3,...columnN)]
VALUES (value1, value2, value3,...valueN);
If not you need to change your syntax to specify the columns.
INSERT INTO TABLE_NAME (column1, column2, column3,...columnN)]
VALUES (value1, value2, value3,...valueN);
#4
Re: no value given for one or more required parameters vb6
Posted 07 August 2012 - 12:32 PM
To expand upon what maj is saying: if you don't specify exactly which columns you want to insert into, the insert statement assumes that you are inserting into all the fields in the table, and expects a value for each field in the table. You're probably not providing the same number of values as there are fields in the table.
#5
Re: no value given for one or more required parameters vb6
Posted 07 August 2012 - 06:38 PM
I try rewrite the code into this :
But there is an error pointed to this structure. Am i writing the proper way of using this syntax?
con.Execute ("insert into Questions (Subjectname, Subjectcode, ExamID, Qno, Qst, Ch1, Ch2, Ch3, Ch4, Ans)Values(combosubject.Text, txtsbcode.Text, Text1.Text, lblQno.caption, txtq.Text, opt1.Text, opt2.Text, opt3.Text, opt4.Text, real.Text,)")
But there is an error pointed to this structure. Am i writing the proper way of using this syntax?
#6
Re: no value given for one or more required parameters vb6
Posted 07 August 2012 - 06:48 PM
I did specify the value in which column i want to insert it and i did provided the same number of values as the number of columns in the fields. And im pretty sure all the values i want to save are exist because i've try it to make it appear in "textbox".
#7
Re: no value given for one or more required parameters vb6
Posted 07 August 2012 - 11:43 PM
Maybe you could tell us the error after you made the changes....Is the error the same, is it a different one?
What is the schema of the Questions table?
You specified 10 columns, 10 values, but you have an extra comma after the last value.
What is the schema of the Questions table?
You specified 10 columns, 10 values, but you have an extra comma after the last value.
#8
Re: no value given for one or more required parameters vb6
Posted 08 August 2012 - 05:54 PM
con.Execute ("insert into Questions (Subjectname, Subjectcode, ExamID, Qno, Qst, Ch1, Ch2, Ch3, Ch4, Ans)Values('" + combosubject.Text + "'," + txtsbcode.Text + _
",'" + Text1.Text + "','" + lblQno.Caption + "','" + txtq.Text + _
"','" + opt1.Text + "','" + opt2.Text + _
"','" + opt3.Text + "','" + opt4.Text + "','" + real.Text + "')")
The problems solved with this code. Thank you for giving me the idea.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|