简体   繁体   中英

Insert a Datatable into mysql database in asp.net

有没有办法将动态生成的数据表插入asp.net中的mysql数据库?

Sub OutputQty(ByVal dt As DataTable, ByVal AdID As Integer)
    Dim sql As String = ""
    Dim con As New SqlConnection(Utilities.DELcon)
    Dim cmd As New SqlCommand(sql, con)
    con.Open()
    For Each row In dt.Rows
        sql = "INSERT INTO DMQtyOutput (AdID, CompanyID, StoreNumber, DemandQty) VALUES ('" & row("AdID") & "','" & row("CompanyID") & "','" & row("StoreNumber") & "','" & row("DemandQty") & "')"
        cmd.CommandText = sql
        cmd.ExecuteNonQuery()
    Next
    con.Close()
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM