Are there ways to add 2 Table when using the INSERT statement in query builder?

試著忘記壹切 提交于 2019-12-11 05:45:53

问题


It seems like the query builder in vb only allow 1 table to use the INSERT statement, so are there any way add more than 1?


回答1:


You should be able to wrap them all into one command call. Here is an example of what I think you are looking for.

how to insert into two tables from vb.net




回答2:


Using con As System.Data.SqlClient.SqlConnection = New SqlConnection("YourConnection string")
    con.Open()
    Dim cmd As New SqlCommand()
    Dim expression As String = "Parameter value"
    cmd.CommandType = CommandType.StoredProcedure
    cmd.CommandText = "Your Stored Procedure"
    cmd.Parameters.Add("Your Parameter Name", SqlDbType.VarChar).Value = expression
    cmd.Connection = con
    Using dr As IDataReader = cmd.ExecuteReader()
        If dr.Read() Then
        End If
    End Using
End Using


来源:https://stackoverflow.com/questions/9255309/are-there-ways-to-add-2-table-when-using-the-insert-statement-in-query-builder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!