E
Eric Kiernan
I'm having two problems. In my tables I have an autoincrement field
called ID, and the type is long ( in Access ). When I try to load it
through c# i have something like this when i try to load the data.
objConnection.Open();
objCommand.CommandText = "SELECT * from BudgetSpending";
objCommand.CommandType = CommandType.Text;
// why i don't have to specify OleDBDataReader reader is beyond me.
reader = objCommand.ExecuteReader();
while ( reader.Read()) {
long ID = (long) reader["ID"];
and c# complains that it can't cast the field into a long. What do i
cast it to? Everything else casts and loads fine.
My second problem is i really want to do something like this
tempTable = "select * from Budget"
// execute a command to perform the select and return the result set to
tempTable
if ( tempTable.Count == 0 )
// then do an insert
All i seem to to have is an ExecuteNonQuery, and an ExecuteReader. I
can't seem to get a count from a dataReader. Help! I know i used to be
able to do something like this in VB6.
called ID, and the type is long ( in Access ). When I try to load it
through c# i have something like this when i try to load the data.
objConnection.Open();
objCommand.CommandText = "SELECT * from BudgetSpending";
objCommand.CommandType = CommandType.Text;
// why i don't have to specify OleDBDataReader reader is beyond me.
reader = objCommand.ExecuteReader();
while ( reader.Read()) {
long ID = (long) reader["ID"];
and c# complains that it can't cast the field into a long. What do i
cast it to? Everything else casts and loads fine.
My second problem is i really want to do something like this
tempTable = "select * from Budget"
// execute a command to perform the select and return the result set to
tempTable
if ( tempTable.Count == 0 )
// then do an insert
All i seem to to have is an ExecuteNonQuery, and an ExecuteReader. I
can't seem to get a count from a dataReader. Help! I know i used to be
able to do something like this in VB6.