Best way to get empty DataTable...via api?

  • Thread starter Thread starter Amil
  • Start date Start date
A

Amil

I have a DB that I want to read and update. My read routines always return
a DataTable of results which makes it easy for user's to access.

Now, for updates, I would also like the user to pass a DataTable (add,
update, delete) to my routines. What is the best way for the USERto get a
DataTable that is initialized with all the correct columns? I think my
routines should return a DataTable to them for use, but I don't know the
best way to create one.

I'm using oledb and there is a OleDbConnection.GetOleDbSchemaTable method;
can this somehow easily create a ready-to-use DataTable for doing things
like:

DataRow row = myroutine.GetFooTable().NewRow();

Thanks. Amil
 
Hi,

You could execute "SELECT ...... FROM MyTable WHERE 1=0" SQL statement. It
will return empty DataTable with the structure
 
Back
Top