R
Robbie
OK, I'm trying to do something very simple...add a record to a
Paradox table, but for the life of me I can't seem to get it right.
Here is a code snippet:
----------------------------
string connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\MyDirectory;Extended Properties=Paradox 5.x;";
OleDbConnection connParadox = new OleDbConnection(connStr);
OleDbDataAdapter daParadox = new OleDbDataAdapter();
OleDbCommand selCmd = new OleDbCommand("SELECT * FROM
MASTER_TABLE",connParadox);
daParadox.SelectCommand = selCmd;
string insCommand = "insert into MASTER_TABLE (ID,CODE) VALUES
(9999,'99999')"; // This statement works using SQL Explorer in
Delphi.
OleDbCommand insCmd = new OleDbCommand(insCommand, connParadox);
daParadox.InsertCommand = insCmd;
//Fill the dataset.
System.Data.DataSet dsParadox = new System.Data.DataSet();
daParadox.Fill(dsParadox); // This works...I get records in the
DataSet.
....
// Update the table. // This doesn't work...compiles OK,
doesn't even raise an error, but no table update.
daParadox.Update(dsParadox);
dsParadox.AcceptChanges();
----------------------------
I've also used the SQL statment:
insert into MASTER_TABLE IN C:\\MyDirectory\\MASTER_TABLE.db paradox
(ID,CODE) VALUES (9999,'99999')
but I get the same thing...nothing.
Could someone tell me what the heck I'm doing wrong, or point me to
some code
sample I could examine.
Paradox table, but for the life of me I can't seem to get it right.
Here is a code snippet:
----------------------------
string connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\MyDirectory;Extended Properties=Paradox 5.x;";
OleDbConnection connParadox = new OleDbConnection(connStr);
OleDbDataAdapter daParadox = new OleDbDataAdapter();
OleDbCommand selCmd = new OleDbCommand("SELECT * FROM
MASTER_TABLE",connParadox);
daParadox.SelectCommand = selCmd;
string insCommand = "insert into MASTER_TABLE (ID,CODE) VALUES
(9999,'99999')"; // This statement works using SQL Explorer in
Delphi.
OleDbCommand insCmd = new OleDbCommand(insCommand, connParadox);
daParadox.InsertCommand = insCmd;
//Fill the dataset.
System.Data.DataSet dsParadox = new System.Data.DataSet();
daParadox.Fill(dsParadox); // This works...I get records in the
DataSet.
....
// Update the table. // This doesn't work...compiles OK,
doesn't even raise an error, but no table update.
daParadox.Update(dsParadox);
dsParadox.AcceptChanges();
----------------------------
I've also used the SQL statment:
insert into MASTER_TABLE IN C:\\MyDirectory\\MASTER_TABLE.db paradox
(ID,CODE) VALUES (9999,'99999')
but I get the same thing...nothing.
Could someone tell me what the heck I'm doing wrong, or point me to
some code
sample I could examine.