VB.Net/Database ADO.net/SqlCommand Builder — различия между версиями

Материал из VB Эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 12:44, 26 мая 2010

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().rumandText)
    End Sub
End Class