473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

RecordInsertion

Hi all,
am working on a project in asp.net backend with sql2005
am getting problem while inserting a record as incorrect syntax near ',' .
there is 60 to 70 fields to insert so am not getting where exactly that error occures is there any chanse to insert like
fieldname=controlname
forex:
"insert into Emp emp_code =" & textbox1.text &
", EmpName='" & textbox2.text & "')"
here Emp is tablename and emp_code,empname are fields,
textboxes were controls

i want it Urgent, Please give suggestion
Thank You
Narendra
Jan 24 '08 #1
1 888
DrBunchman
979 Expert 512MB
Narendra,

A SQL Insert statement should follow this syntax:

INSERT INTO TableName (Column1Name, Column2Name, Column3Name)
VALUES('Value1', 'Value2', 'Value3')

So for your example if sSQL was your SQL string it would be:

sSQL = ""
sSQL += "INSERT INTO emp (emp_code, EmpName)"
sSQL += "VALUES ('" & textbox1.text & "', '" & textbox2.text & "')"

Does this help?

Dr B
Jan 24 '08 #2

Sign in to post your reply or Sign up for a free account.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.