K
kids
Hi all,
I wrote a simple application using C# & Ms. Access DB.
1. Read all record from database into dataset and perform searching
functionality. (work)
2. I want to add new record into the database if searching fail. (problem)
Here is the procedure:
MyTable has 2 columns only (myKey | myValue) where myKey is the PK and
myValue column is allow null.
....C# coding
private OleDbDataAdapter da;
private DataSet dsMyTable;
AddRow(string newKey){
DataTable dt = dsMyTable.Tables["MyTable"];
DataRow irow = dt.NewRow();
irow[0] = newKey;
dt.Rows.Add(irow);
da.Update(dsMyTable,"MyTable");
}
there was no error.
But when I check in MyTable I couldn't find new record added ??!!!
Please advices,
Sokun
I wrote a simple application using C# & Ms. Access DB.
1. Read all record from database into dataset and perform searching
functionality. (work)
2. I want to add new record into the database if searching fail. (problem)
Here is the procedure:
MyTable has 2 columns only (myKey | myValue) where myKey is the PK and
myValue column is allow null.
....C# coding
private OleDbDataAdapter da;
private DataSet dsMyTable;
AddRow(string newKey){
DataTable dt = dsMyTable.Tables["MyTable"];
DataRow irow = dt.NewRow();
irow[0] = newKey;
dt.Rows.Add(irow);
da.Update(dsMyTable,"MyTable");
}
there was no error.
But when I check in MyTable I couldn't find new record added ??!!!
Please advices,
Sokun