Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
SqlCommand cmd = new SqlCommand("Insert into ItemTable values ( @spicid,@stitle)",Conn);
cmd.Parameters.AddWithValue("@spicid", spicid);
cmd.Parameters.AddWithValue("@stitle", stitle);
cmd.ExecuteNonQuery();

Where should I put the column name ( means column name of sql table) either in command text or in AddWithValue function?
Posted
Updated 1-May-13 6:09am
v5
Comments
Richard C Bishop 1-May-13 11:48am    
Put the column name of the columns you want to add to in the insert statement right after the table name.

1 solution

Try:
SQL
INSERT INTO ItemTable (ColumnName1, ColumnName2) VALUES (@spicid, @stitle)
 
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