J
jdressing1
Guest
Is there a way to get the full SQL Update statement out of the SqlCommandBuilder object? The UpdateCommand.CommandText just returns SQL that requires parameters be passed. I want a complete SQL statement that will work if I run it direct... not using the Update command. I am wanting the ability to cache updates if the server is not available, so I am wanting to save the SQL for use later. Here is a snippet of my code:
sqlConn = New SqlConnection(AppConnection)
sqlConn.Open()
sqlAdapter = New SqlDataAdapter
sqlAdapter.SelectCommand = New SqlCommand
sqlAdapter.SelectCommand.Connection = sqlConn
sqlAdapter.SelectCommand.CommandText = "SELECT * FROM MyTable"
Dim objSQLBuilder As SqlCommandBuilder = New SqlCommandBuilder(sqlAdapter)
objSQLBuilder.ConflictOption = ConflictOption.OverwriteChanges
sqlAdapter.UpdateCommand = objSQLBuilder.GetUpdateCommand()
Dim strUpdateCmd As String = sqlAdapter.UpdateCommand.CommandText
sqlAdapter.Update(dtDataTable)
Thank you for any help!
Continue reading...
sqlConn = New SqlConnection(AppConnection)
sqlConn.Open()
sqlAdapter = New SqlDataAdapter
sqlAdapter.SelectCommand = New SqlCommand
sqlAdapter.SelectCommand.Connection = sqlConn
sqlAdapter.SelectCommand.CommandText = "SELECT * FROM MyTable"
Dim objSQLBuilder As SqlCommandBuilder = New SqlCommandBuilder(sqlAdapter)
objSQLBuilder.ConflictOption = ConflictOption.OverwriteChanges
sqlAdapter.UpdateCommand = objSQLBuilder.GetUpdateCommand()
Dim strUpdateCmd As String = sqlAdapter.UpdateCommand.CommandText
sqlAdapter.Update(dtDataTable)
Thank you for any help!
Continue reading...