Last post Nov 02, 2011 11:05 AM by reddy.net
Nov 12, 2010 12:02 PM|reddy.net|LINK
I have a SQL database. I am getting a datatable from SQL. In SQL Query the table is having null values in the output. But when it is coming to the front end, the
null values are replaced by empty values.
So in the front end in the datatable i am having empty values in some cells.
I am trying to insert this datatable into access. For this i am using following code...
OleAdpData.InsertCommand.Connection = OleConn; // OleConn is the OleDbConnection
OleAdpData.Update(dtData); // dtData is the datatable
It is inserting the datatable to access database.
But it is inserting the empty spaces as present in the datatable. I want to insert NULL into the cells in access datatable where the cells are empty....
Where should i add my logic for this... Guys pls help me...
Nov 15, 2010 03:06 AM|srinivaskotra|LINK
MySQLStatement = "INSERT INTO MyTable " & _
"(Column1, Column2) Values('A Value', null)"
more information here
Nov 15, 2010 09:54 AM|reddy.net|LINK
The query which you have suggested does not suit my scenario. In my scenario i am directly copying datatable to access.
Can u suggest me a solution which suits my scenario...
Nov 17, 2010 03:40 AM|Wencui Qian - MSFT|LINK
How did you get data? Can you convert the NULL value to empty string when retrieving? Also, you may consider to convert it back to NULL values. Please show us more details so that we can know the exact problem. Thanks.
Nov 26, 2010 02:34 AM|KumarHarsh|LINK
As far as i know to you cannot enter null it will be always empty string in mdb.
Though you can try while populating dtData when it is empty convert it to null.
Nov 02, 2011 11:05 AM|reddy.net|LINK
This is fixed. The access does not show null values explicitly but it contains the null values.
We can query the access tables with null, it works.