Click here to Skip to main content
15,906,708 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ssql = "insert into store_master(vono,trndate,invoiceno,invoicedate,supcode,description,gross,discount,net,taxt_rate,total_amont,discountafter,fright,payable,naration,site) values" & _
"('" & Me.txt_grn.Text & "','" & DateTime.Today().ToString("MM/dd/yyyy") & "','" & Format(Me.dtp_srv.Value, "MM/dd/yyyy") & "'," & _
"'" & Me.txt_invoiceno.Text & "','" & DateTime.Today().ToString("MM/dd/yyyy") & "','" & Format(Me.dtp_invoicedate.Value, "MM/dd/yyyy") & "'," & _
"'" & Me.txt_supcod.Text & "','" & Me.cmbsupp.Text & "'," & _
"'" & Me.txt_gross.Text & "'," & _
"'" & Me.txt_discount.Text & "','" & Me.txt_net.Text & "'," & _
"'" & Me.cmbtax.Text & "'," & _
"'" & Me.txt_Tamont.Text & "'," & _
"'" & Me.txt_afterdsc.Text & "'," & _
"'" & Me.txt_freight.Text & "'," & _
"'" & Me.txt_pyable.Text & "'," & _
"'" & Me.txt_naration.Text & "','" & loginsite & "')"
fn.saveqry(ssql, tblname)
tblname = String.Empty
ssql = String.Empty
tblname = "store_child"
For tcnt = 1 To .Rows.Count - 1
If Convert.ToString(.GetData(tcnt, "itmcode")) = "" Or Convert.ToString(.GetData(tcnt, "iname")) = "" Then


Call txtclear()
hcode = String.Empty
Call maxno()
Exit Sub
End If
ssql = "insert into store_child(vono,site,itmcode,iqty,irate,itotal,remark) values" & _
"('" & Me.txt_grn.Text & "','" & loginsite & "'," & _
"'" & Replace(CStr(.GetData(tcnt, "itmcode")), "-", "") & "'," & _
"'" & CStr(.GetData(tcnt, "iqty")) & "'," & _
"'" & CStr(.GetData(tcnt, "irate")) & "'," & _
"'" & CStr(.GetData(tcnt, "itotal")) & "'," & _
"'" & CStr(.GetData(tcnt, "remark")) & "'"




this is my insert statement with my data table coloumns,
but when i execute this code
it show this error

there are fewer column in the insert statement then values specified in the values clause,the number of columns must match the number of columns specified in insert statements...


i checked out it but columns in values clause and in insert statements are the same,plz help me out..............
Posted

VB
ssql = "insert into store_master(vono,trndate,invoiceno,invoicedate,supcode,description,gross,
discount,net,taxt_rate,total_amont,discountafter,fright,payable,naration,site) values" & _
"('" & Me.txt_grn.Text & "','" & DateTime.Today().ToString("MM/dd/yyyy") & "','" & Format(Me.dtp_srv.Value, "MM/dd/yyyy") & "'," & _
"'" & Me.txt_invoiceno.Text & "','" & DateTime.Today().ToString("MM/dd/yyyy") & "','" & Format(Me.dtp_invoicedate.Value, "MM/dd/yyyy") & "'," & _
"'" & Me.txt_supcod.Text & "','" & Me.cmbsupp.Text & "'," & _
"'" & Me.txt_gross.Text & "'," & _
"'" & Me.txt_discount.Text & "','" & Me.txt_net.Text & "'," & _
"'" & Me.cmbtax.Text & "'," & _
"'" & Me.txt_Tamont.Text & "'," & _
"'" & Me.txt_afterdsc.Text & "'," & _
"'" & Me.txt_freight.Text & "'," & _
"'" & Me.txt_pyable.Text & "'," & _
"'" & Me.txt_naration.Text & "','" & loginsite & "')"

SQL
You have 16 columns mentioned whereas 18 values have been provided in the insert SQL.
 
Share this answer
 
you said that verified the variables exactly matched
then there may be problem in one situation


if the data supplied by you contains single quote or comma you need to handle those ..
debug it get the query and execute it in database directly..u will get it try it
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900