G
Guest
Hello Experts,
after calling 'adapter.Fill(table, recordset);' or 'adapter.Fill(dataSet,
recordset, tableName);', the last record from 'recordset' is missing in
'dataSet.Tables[tableName]'.
Here's what I'm doing:
//open recordset
ADODB.Recordset recordset = new ADODB.RecordsetClass();
recordset.Open(
sql,
connection, ADODB.CursorTypeEnum.adOpenUnspecified, ADODB.LockTypeEnum.adLockReadOnly,
(int)ADODB.ExecuteOptionEnum.adOptionUnspecified);
//output count of records
Trace.WriteLine("recordset.RecordCount.Count: " +
recordset.RecordCount.ToString());
//go to the first record
if(!recordset.BOF){
recordset.MoveFirst();
}
//fill the DataSet
OleDbDataAdapter adapter = new OleDbDataAdapter();
adapter.Fill(dataSet, recordset, tableName);
//output count of records
Trace.WriteLine("dataSet.Tables[tableName].Rows.Count: "+
dataSet.Tables[tableName].Rows.Count);
The Trace file says:
recordset.RecordCount.Count: 7
dataSet.Tables[tableName].Rows.Count: 6
The missing record is always the last record that had been saved before
running the application. If I add a row to the database (an Exchange 2000
store) and run the application again, the missing row is there again and my
new row is missing.
What's going on here?!
Thanks for every hint,
corinna
after calling 'adapter.Fill(table, recordset);' or 'adapter.Fill(dataSet,
recordset, tableName);', the last record from 'recordset' is missing in
'dataSet.Tables[tableName]'.
Here's what I'm doing:
//open recordset
ADODB.Recordset recordset = new ADODB.RecordsetClass();
recordset.Open(
sql,
connection, ADODB.CursorTypeEnum.adOpenUnspecified, ADODB.LockTypeEnum.adLockReadOnly,
(int)ADODB.ExecuteOptionEnum.adOptionUnspecified);
//output count of records
Trace.WriteLine("recordset.RecordCount.Count: " +
recordset.RecordCount.ToString());
//go to the first record
if(!recordset.BOF){
recordset.MoveFirst();
}
//fill the DataSet
OleDbDataAdapter adapter = new OleDbDataAdapter();
adapter.Fill(dataSet, recordset, tableName);
//output count of records
Trace.WriteLine("dataSet.Tables[tableName].Rows.Count: "+
dataSet.Tables[tableName].Rows.Count);
The Trace file says:
recordset.RecordCount.Count: 7
dataSet.Tables[tableName].Rows.Count: 6
The missing record is always the last record that had been saved before
running the application. If I add a row to the database (an Exchange 2000
store) and run the application again, the missing row is there again and my
new row is missing.
What's going on here?!
Thanks for every hint,
corinna