how does OleDbCommand know row to execute on? 
Author Message
 how does OleDbCommand know row to execute on?

I want to tell a command object what row in a data set
to 'execute on'.  In other words, to apply its parameters
to the values of the fields of a row, and then execute
the command onto the database through its connection.

A related issue, how can I say 'ignore concurrency'?

Why these questions?  I am trying to use the insert
command of a OleDBDataAdapter to populate an empty table
in a database that I have just created, based on data
contained in a data set.  The rows in that data set have
NOT just been added, they come from another database.  
Therefore those rows think they are 'unchanged', so the
Update method of the data adapter won't try to create
records based on them.  So, I'm trying to force the
insert command to happen, on every row in the data set.

Any explanations or suggestions would be appreciated.



Sun, 05 Jun 2005 22:24:42 GMT  
 how does OleDbCommand know row to execute on?
Hi Eric-
The following code will 'touch' each datarow and change the rowstate to
"modified" so the DataAdapter knows to send the changes from table (0) to
the database:

Dim dr As DataRow
For Each dr In DataSet.Tables(0).Rows
  dr.BeginEdit()
  dr.EndEdit()
Next

You still need to call the Update method of the dataadapter.

hope this helps,

Steve Stein
VB Team

--
This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:
> I want to tell a command object what row in a data set
> to 'execute on'.  In other words, to apply its parameters
> to the values of the fields of a row, and then execute
> the command onto the database through its connection.

> A related issue, how can I say 'ignore concurrency'?

> Why these questions?  I am trying to use the insert
> command of a OleDBDataAdapter to populate an empty table
> in a database that I have just created, based on data
> contained in a data set.  The rows in that data set have
> NOT just been added, they come from another database.
> Therefore those rows think they are 'unchanged', so the
> Update method of the data adapter won't try to create
> records based on them.  So, I'm trying to force the
> insert command to happen, on every row in the data set.

> Any explanations or suggestions would be appreciated.



Sat, 25 Jun 2005 05:47:51 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Thread Done Event Handler never executed ?

2. Prob: Error Doing Connection.Execute While In Transaction

3. Anybody done a 2 checkboxes per row dropdown list

4. How to knowing when a query is done

5. I know someone has done this before...

6. OleDbCommand: exception with parameter of type LongVarWChar and empty String

7. OleDbCommand

8. Adding parameters to OleDbCommand

9. AnyOne knows How It can Be Done?

10. AnyOne knows How It can Be Done?

11. How to know when Print Spooler is done?

12. Doe's anybody knows how to...

 

 
Powered by phpBB® Forum Software