|
-
Jul 4th, 2007, 10:53 PM
#1
Thread Starter
Fanatic Member
[2.0] c# ado.net
why this code doesnt work?
string ConStr = "Provider=Microsoft.Jet.OleDB.4.0; Data Source =" + Application.StartupPath + "\\Employee.mdb";
OleDbConnection Conn = new OleDbConnection(ConStr);
Conn.Open();
OleDbCommand Cmd = new OleDbCommand("Select * from Employee", Conn);
OleDbDataAdapter dAdapter = new OleDbDataAdapter(Cmd);
DataSet dDataSet = new DataSet();
DataRow AddNewRow = dDataSet.Tables["Employee"].NewRow();
AddNewRow["EmployeeID"] = textBox1.Text;
AddNewRow["EmployeeName"] = textBox2.Text;
dDataSet.Tables["Employee"].Rows.Add(AddNewRow);
dAdapter.Update(dDataSet, "Employee");
Conn.Close();
Use the "new" keyword to create an object instance.
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
|