Nick,
That worked perfectly! Unfortunately, I found I have a little different
problem that I thought I did. Creating a new table allows me to fill a
DataSet, insert records, update the database, etc... But I've written a
method that retrieves some information from the net and sends it back in the
form of a NEW DataTable. Is it possible to just "copy" this DataTable into
the DataSet and save the results to the database? I thought creating a new
table in the database first would solve this problem, but when I try to copy
the DataSet back I get an error; either that there is no mapping name (you
helped me solve this by creating a matching table name in the database) or
that there is nothing to update (I guess because the DataRowState of the
newly created table doesn't show any changes and therefore no changes are
written to the database). Would my best approach be to:
1). Copy the new DataTable row by row (in a loop) to the bound DataSet
(therefore making it look like they are all new records)?
2). Change the DataRowState to Modified in the new DataTable, and add the
table to the DataSet?
3). Pound my head on the wall?
If any of that makes sense... any extra help you could provide would be
appreciated.
Thanks,
Jacob
"Nick Malik" <ni*******@hotmail.nospam.com> wrote in message
news:uu6Kb.59455$I07.257367@attbi_s53...
What database are you using?
If you are using SQL Server or MSDE, the command would be
CREATE TABLE MyTable ( field1 type, field2 type, field3 type)
I assume Access would be similar.
Better yet, use SQL DMO. These objects give you real power.
Once the table is created, you can use ordinary ADO.NET objects to create
data sets and insert records.
--- Nick
"Jacob" <ja**********@hotmail.com> wrote in message
news:qp5Kb.17620$7D3.3391@fed1read02... A simple question:
I've read a couple of things that indicates I can create a new table in
my database using some SQL command. Is this correct? I would like to load
a database into a DataSet, make changes to the existing DataTable(s), add
NEW DataTable(s) if necessary and save the changes back to the database.
I'm stuck on this problem. Any documentation on this would be great.
Thanks,
Jacob