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
plot
NA
8
0
DataAdapter Update Method
Sep 15 2004 6:28 AM
Hi Guys I'm trying to use the Update method of my DataAdapter. As i understnad it, i fill a dataset with my DataAdapter, make the changes to my Dataset, then i can call the update method of the DataAdapter and .Net will determin the changes and perform the update. I get an exception asking for an update or insert command object for the DataAdapter. Surley if i have to write my own Commands for updates and Inserts etc the Update method of the DataAdapter is pointless? Here is the code: string ConnString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=C:\\C#\\db.mdb"; OleDbConnection conn = new OleDbConnection(ConnString); OleDbCommand cmd = new OleDbCommand("SELECT * FROM tblData", conn); OleDbDataAdapter adapter = new OleDbDataAdapter(); adapter.SelectCommand = cmd; DataSet ds = new DataSet(); DataTable dt = new DataTable("tbl"); ds.Tables.Add(dt); try { conn.Open(); adapter.Fill(ds.Tables["tbl"]); } catch(System.Data.OleDb.OleDbException ex) { Console.WriteLine(ex.Message); } catch(Exception exx) { Console.WriteLine(exx.Message); } finally { conn.Close(); } System.Data.DataRow NewRow = ds.Tables["tbl"].NewRow(); NewRow["dbName"] = "Peter"; NewRow["dbAge"] = 25; ds.Tables["tbl"].Rows.Add(NewRow); adapter.Update(dt); Console.WriteLine("Update Successful"); Any help would be much appriceated. Thanks Guys Chris
Reply
Answers (
4
)
Oracle Package Usage
Data provider internal error("-3000")