olichap
May 1st, 2002, 01:12 PM
I have a dataset whose structure is built using an xml schema and whose data is populated through the parsing of a text file. I do not have an OleDBDataAdapter or OleDbCommand associated with the dataset since I'm not selecting records from the database into the data object. The dataset is not "bound" to anything.
The documentation I have on updating the dataset info to my SQL Server database seems to make the process a bit more involved than necessary (I say this, but since this represents my first use of the dataset, what do I know?).
Anyway, it seems to require the use of a Command object for each update statement (I have about 14 tables in my dataset that will update). Then the doc mentions the need to assign each field in my dataset.table to the command's Parameters array. All this seems a bit un-necessary to me.
Can you loop through as with ADO (do while not .eof) and utilized an "execute" method that executes an SQL string to insert the current row? Are there other ways to accomplish the same task of inserting records into the table?
I have the dataset tables and rows all set. Now I need to update to the SQL server database FROM the dataset. I could use the DataAdapter's InsertCommand property but then I'd have to set all the Command.Parameters with every field in my dataset (I have 14 or so tables).
In ADO 25/27 we could utilize the Execute method and an sql string to insert values from the current recordset.row into the table. I'd like figure out how to do this through .NET. My dataset is not populated through a SELECT statement but through code and the parsing of a text file, so is not bound to the database at all.
I figure I might be able to make use of the Command.ExecuteNonQuery method somehow but still have the problem of iterating through the records.
What is the NET equivalent of ADO25's Do While Not .EOF?
What is the best way to iterate through the Dataset.Tables.Rows?
When inserting data into the DataTable I have to find the current row by doing something like this:
iint = dsEDI.Tables("Header").Rows.Count - 1
dsEDI.Tables("Header").Rows(iint)!ContactName = arSeg(2)
I guess I could iterate through the dataset the same way to do my insert (a loop based on iint and the Rows.Count) but have to think NET has a better way have handling the basic requirement of moving through records.
Any ideas would be greatly appreciated
Thanks,
O.
The documentation I have on updating the dataset info to my SQL Server database seems to make the process a bit more involved than necessary (I say this, but since this represents my first use of the dataset, what do I know?).
Anyway, it seems to require the use of a Command object for each update statement (I have about 14 tables in my dataset that will update). Then the doc mentions the need to assign each field in my dataset.table to the command's Parameters array. All this seems a bit un-necessary to me.
Can you loop through as with ADO (do while not .eof) and utilized an "execute" method that executes an SQL string to insert the current row? Are there other ways to accomplish the same task of inserting records into the table?
I have the dataset tables and rows all set. Now I need to update to the SQL server database FROM the dataset. I could use the DataAdapter's InsertCommand property but then I'd have to set all the Command.Parameters with every field in my dataset (I have 14 or so tables).
In ADO 25/27 we could utilize the Execute method and an sql string to insert values from the current recordset.row into the table. I'd like figure out how to do this through .NET. My dataset is not populated through a SELECT statement but through code and the parsing of a text file, so is not bound to the database at all.
I figure I might be able to make use of the Command.ExecuteNonQuery method somehow but still have the problem of iterating through the records.
What is the NET equivalent of ADO25's Do While Not .EOF?
What is the best way to iterate through the Dataset.Tables.Rows?
When inserting data into the DataTable I have to find the current row by doing something like this:
iint = dsEDI.Tables("Header").Rows.Count - 1
dsEDI.Tables("Header").Rows(iint)!ContactName = arSeg(2)
I guess I could iterate through the dataset the same way to do my insert (a loop based on iint and the Rows.Count) but have to think NET has a better way have handling the basic requirement of moving through records.
Any ideas would be greatly appreciated
Thanks,
O.