目前,我正在使用SQLAdapter Update命令更新从DataTable到SQL数据库的更改。如果服务器不可用,我想知道如何缓存更改以供日后使用。有没有办法从Update命令中提取SQL并稍后在数据库上执行它们?
sqlConn = New SqlConnection(AppConnection)
sqlConn.Open()
sqlAdapter = New SqlDataAdapter
sqlAdapter.SelectCommand = New SqlCommand
sqlAdapter.SelectCommand.Connection = sqlConn
sqlAdapter.SelectCommand.CommandText = "SELECT * FROM SampleTable"
Dim objSQLBuilder As SqlCommandBuilder = New SqlCommandBuilder(sqlAdapter)
'THIS IS NOT RETURNING THE COMPLETE SQL STATEMENT
sqlAdapter.UpdateCommand = objSQLBuilder.GetUpdateCommand()
'IF THIS FAILS, I WANT TO CACHE THE SQL AND EXECUTE THE SQL LATER...
sqlAdapter.Update(dtDataTable)
感谢您的帮助!