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
Nwenar Ismail
NA
83
5.3k
Incorrect syntax for Set
May 3 2021 4:03 AM
Hello Mates I have a database project. I have created a button to update Data From my database so Whenever I try to update or test the Button which will do the update It says incorrect syntax near Set
So I will Write My Codes for updating
Thank You Guys
I got the code fromC-SharpCorner
here is the link Edit_Update Data From a Database in Windows Forms (c-sharpcorner.com)
string str = "server = ADAM\\SQLEXPRESS;; Initial Catalog = GYM; Integrated security=true";
SqlConnection con = new SqlConnection(str);
/* ///// The Error is Coming from This LINE //// */
String query = "Update Set First_Name = '" + this.First_Name.Text + "', Second_Name= '" + this.Second_Name.Text + "',Last_Name= '" + this.Last_Name.Text + "',Age ='"+this.Age_Value.Value +"' where ID= '" + this.ID.Text + "' ";
SqlCommand cmd = new SqlCommand(query, con);
SqlDataReader dbr;
try
{
con.Open();
dbr = cmd.ExecuteReader();
MessageBox.Show("Updated data");
while (dbr.Read())
{
}
}
catch (Exception es)
{
MessageBox.Show(es.Message);
}
Reply
Answers (
2
)
how do i add a menu to a button
how do i save a richtextbox.rtf with ctrl-V text?