TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
PankaJ D
NA
154
0
insert error
Mar 8 2010 4:32 AM
SqlConnection cn = new SqlConnection(MyConn.cnstring);
//string sql = "insert into Insert1 values(?,?,?,?,?)";
SqlCommand cmd ;
cmd = new SqlCommand("insert into Insert1 values(?,?,?,?,?)", cn);
cmd.Parameters.AddWithValue("sname", txtname.Text);
cmd.Parameters.AddWithValue("srno", txtrno.Text);
cmd.Parameters.AddWithValue("sdob", dob.Value);
cmd.Parameters.AddWithValue("sadd", txtadd.Text);
cmd.Parameters.AddWithValue("sgender", cmdgender.Text);
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
When I use this code folowing error will gererate
"Incorrect syntax near '?'."
Reply
Answers (
4
)
picture box
How do I: Add NodeName and NodeTag ?