 |
|
VB.NET จะอัพเดทข้อมูลลงฐานข้อมูลทีละหลาย Record ยังไงครับ Web (ASP.NET) |
|
 |
|
|
 |
 |
|
ถ้าเป็น GridView จะใช้ Loop ประมาณนี้ครับ
Code (VB.NET)
For i = 0 To myGridView.Rows.Count - 1
strCustomerID = CType(myGridView.Rows(i).FindControl("txtAddCustomerID"),TextBox)
strName = CType(myGridView.Rows(i).FindControl("txtAddName"),TextBox)
strEmail = CType(myGridView.Rows(i).FindControl("txtAddEmail"),TextBox)
strCountryCode = CType(myGridView.Rows(i).FindControl("txtAddCountryCode"),TextBox)
strBudget = CType(myGridView.Rows(i).FindControl("txtAddBudget"),TextBox)
strUsed = CType(myGridView.Rows(i).FindControl("txtAddUsed"),TextBox)
'*** Insert Statement ***'
strSQL = "INSERT INTO customer (CustomerID,Name,Email,CountryCode,Budget,Used) " & _
" VALUES " & _
" ('" & strCustomerID.Text & "','" & strName.Text & "','" & strEmail.Text & "', " & _
" '" & strCountryCode.Text & "','" & strBudget.Text & "','" & strUsed.Text & "')"
With objCmd
.Connection = objConn
.CommandText = strSQL
.CommandType = CommandType.Text
End With
objCmd.ExecuteNonQuery()
Next
|
 |
 |
 |
 |
Date :
2013-01-01 08:16:39 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|