Insert INTO Syntax Error

May 19 2009 6:06 AM

Hi All

I'm using OleDB to connect to two Access 95 databases, ancient I know, I am required to copy data from one to the second exact copy in a different environment. The Select statement works as it should and I have stored the recordset in an OleDbDataReader. The column types are Text and the last four columns are Number. I think my issue is when any of the Numeric fields is a blank field,
DesignReader.GetValue(6-9) = "", (they are allowed in DB), and as I understand the .GetValue should retrieve the exact data including its type so if I can select the data why can't I Insert it back in?

Am I required to substitute the blank record with DBNull? If so what’s the c# equivalent to Access 95 Number?


string InsertQuery = "Insert INTO Designer " +
 "([Profile], ScreenID, RecType, SubType, Sequence, Data, Numeric1, Numeric2, Numeric3, Numeric4) " + "VALUES ('" + Value1 + "', '" + sScreenId + "', '" + Value2 + "', '" + Value3 + "', '" + Value4 + "', '" + Value5 + "', " + DesignReader.GetValue(6) + ", " + DesignReader.GetValue(7) + ", " + DesignReader.GetValue(8) + ", " + DesignReader.GetValue(9) + ")";


Many thanks for any ideas and suggestions.
Christian

 


Answers (1)