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
hopera
NA
4
0
Dataset update doesn't work
Apr 20 2004 4:33 AM
Hi to all ..... I have a problem on this code: this is sistattically correct but doesn't work. What i would like to do it's get data from a SQL server table , fill a dataset , modifiy and update the SQL table with a dataadapter. Maybe the error can be in the Update command statement... Can anyone give me a suggest ? Thank in advance George Here is the code i used: string strConn; strConn = "data source=MyDataSource;initial catalog=PTI;persist security info=False;user id=sa;workstation id=MyWksId;packet size=4096"; SqlConnection SqlConn = new SqlConnection(strConn); SqlConn.Open(); string strQry = "select * from mySQLtable"; SqlCommand cmd = new SqlCommand(strQry,SqlConn); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand=cmd; DataSet ds = new DataSet(); da.Fill(ds,"mySQLtable"); strQry = "Update mySQLtable set flag = 2"; cmd.CommandText = strQry; da.UpdateCommand=cmd; da.Update(ds,"mySQLtable"); SqlConn.Close();
Reply
Answers (
2
)
How to retrieve data from database and put it into text box...
DataReader into DataTable