Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to retrieve Update Query generated by the CommandBuilder

Status
Not open for further replies.

raabbasi

Technical User
Jun 21, 2005
52
PK
I tried the expected GetUpdateCommand method of the CommandBuilder object to retrieve the Update Query generated by the object. But, it just returns the fully qualified name of the object ("System.Data.OleDb.OleDbCommand").
I could not find any other way. If anyone can let me know, how can I get the required result.
Thanks in anticipation.
R. A. Abbasi
 
Have you tried looking at the CommandText?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I don't think CommandText has anything to do with the CommandBuilder object.
 
I do think ca8msm is correct

Code:
        Dim cmd As New System.Data.OleDb.OleDbCommand
        Dim cbu As New System.Data.OleDb.OleDbCommandBuilder
        Dim con As New System.Data.OleDb.OleDbConnection
        Dim adp As New System.Data.OleDb.OleDbDataAdapter
        Dim dt As New DataTable

        con.ConnectionString = "..."
        con.Open()
        cmd.Connection = con
        cmd.CommandType = CommandType.Text
        cmd.CommandText = "select * from table"
        adp.SelectCommand = cmd
        adp.Fill(dt)
        adp.InsertCommand = cbu.GetInsertCommand
        adp.DeleteCommand = cbu.GetDeleteCommand
        adp.UpdateCommand = cbu.GetUpdateCommand
        Dim str As String
        str = adp.UpdateCommand.CommandText

the sql you want is in the str.

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
Sorry, both of you are right. Thanks and regards.
R. A. Abbasi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top