|
-
Sep 17th, 2005, 07:54 AM
#1
Thread Starter
Junior Member
Adding data to database by using dataSet
Hi,
Will that be possible to add a data to a database by using dataSet ??
Thanks
-
Sep 22nd, 2005, 03:36 AM
#2
Sleep mode
Re: Adding data to database by using dataSet
in conjunction with the updater obj (dataAdapter)
-
Sep 22nd, 2005, 09:34 AM
#3
Thread Starter
Junior Member
Re: Adding data to database by using dataSet
hm... do you mind posting some code ?? been google them out, but can not find any...
Thanks pirate
-
Sep 22nd, 2005, 11:51 AM
#4
Sleep mode
This saves the data in two columns "IDNumber and Name" and update the database . I assume you know how to create proper connection string that uses MS Access as backend.
Code:
CONN.OpnConnection();
string SQLStr ="SELECT * FROM TableXXX";
OleDbDataAdapter MyAdapter =new OleDbDataAdapter (SQLStr,CONN);
OleDbCommandBuilder builder =new OleDbCommandBuilder (MyAdapter);
DataSet mydataset =new DataSet() ;
MyAdapter.Fill(mydataset,"TableXXX");
DataRow MyDataRow =mydataset.Tables["TableXXX"].NewRow();
MyDataRow["IDNumber"]="55820"
MyDataRow["Name"]="John";
.........
........
mydataset.Tables["TableXXX"].Rows.Add(MyDataRow);
MyAdapter.Update(mydataset,"TableXXX");
MessageBox.Show("Data Saved into TableXXX", "Saved");
CONN.ClosConnection();
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|