How To

  • Thread starter Thread starter Jacek Jurkowski
  • Start date Start date
J

Jacek Jurkowski

Im making some select using OleDbDataAdapter.
Adapter fills my DataSet with selected data.
How to inform OleDbDataAdapter to convert specified
OleDbTypes to eqivalent c# types. How to make it to
allways change f.e. char to string and numeric to double.
You must remember that i don't know what tables will
be returned.
 
The data stored in the data adapter is stored as raw objects. You can
convert it to whatever compatible C# datatype is that you want. You can use
a switch/case statement based on the SQL type and in the case statements,
handle each specific type and convert the data using Convert.ToXXX or
whatever method suits you.

Pete
 
By now I'm making a simpliets query to obtain structure only.
f.e. "select * from orders where id > 1000" im sending "select * from orders
where 0=1"
Then I'm changing the result tables column types. Tables are empty so it's
allowed.
Then I'm sending the full query and DataAdapter fills DataSet witch hanged
column types
automaticaly converting the values. But I would like to remove the first
query somehow...
 
Back
Top