Are there ways to add 2 Table when using the INSER

2019-08-02 06:10发布

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?

2条回答
爷的心禁止访问
2楼-- · 2019-08-02 06:52

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

查看更多
姐就是有狂的资本
3楼-- · 2019-08-02 06:53
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
查看更多
登录 后发表回答