SQL command Builder: generate Update command from select command
Imports System
Imports System.Data
Imports System.Data.SqlClient
Public Class MainClass
Shared Sub Main()
Dim MyDS As DataSet = New DataSet()
Dim Connection As SqlConnection = New SqlConnection( _
"Server=(local)\SQLEXPRESS;Initial Catalog=MyDatabase;Integrated Security=SSPI")
Connection.Open()
Dim MyDA As SqlDataAdapter = New SqlDataAdapter( _
"SELECT * FROM [Order Details] OD", Connection)
Dim myBuilder As SqlCommandBuilder = New SqlCommandBuilder(MyDA)
Console.WriteLine(myBuilder.GetUpdateCommand().CommandText)
End Sub
End Class
Related examples in the same category