|
|
|
อัพเดต Dataset ลง Database แบบลงอีกตารางที่ไม่ใช่ตารางที่ดึงข้อมูลมา |
|
|
|
|
|
|
|
Code (VB.NET)
Dim str As String = ""
Dim conStr As String = "Data Source = XXXXXX;" _
& " Initial Catalog = XXXXX ;" _
& " Persist Security Info = True ;" _
& " User ID = XXX ;" _
& " Password = XXXXXXXXX ;"
connection = New SqlConnection(conStr)
connection4.Open()
str = "Insert Into RESERVATION (GOODS_DETAIL,AMOUNT,TYPE,EMPLOYEE_RES,CUSTOM_TEL,DATE_RES)"
sql &= "Values (@GOODS_DETAIL,@AMOUNT,@TYPE,@EMPLOYEE_RES,@CUSTOM_TEL,@DATE_RES)"
command4 = New SqlCommand(str, connection4)
adapter = New SqlDataAdapter(command4)
For r As Integer = 0 To DataGridView1.RowCount - 1
With command3
.Parameters.AddWithValue("GOODS_DETAIL", DataGridView1.Rows(r).Cells(0).Value)
.Parameters.AddWithValue("AMOUNT", DataGridView1.Rows(r).Cells(1).Value)
.Parameters.AddWithValue("TYPE", DataGridView1.Rows(r).Cells(2).Value)
.Parameters.AddWithValue("EMPLOYEE_RES", CDbl(DataGridView1.Rows(r).Cells(3).Value))
.Parameters.AddWithValue("CUSTOM_TEL", CDbl(DataGridView1.Rows(r).Cells(4).Value))
.Parameters.AddWithValue("DATE_RES", DataGridView1.Rows(r).Cells(5).Value)
End With
command3.ExecuteNonQuery()
command3.Parameters.Clear()
Next
connection4.Close()
MessageBox.Show("บันทึกข้อมูลเรียบร้อยแล้ว", "ข้อความ", MessageBoxButtons.OK, MessageBoxIcon.None)
End Sub
Tag : .NET, VB.NET
|
|
|
|
|
|
Date :
2013-03-20 11:38:05 |
By :
5555 ไม่รู้อ่ะ |
View :
761 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (VB.NET)
Dim str As String = ""
Dim conStr As String = "Data Source = XXXXXX;" _
& " Initial Catalog = XXXXX ;" _
& " Persist Security Info = True ;" _
& " User ID = XXX ;" _
& " Password = XXXXXXXXX ;"
connection = New SqlConnection(conStr)
connection4.Open()
str = "Insert Into RESERVATION (GOODS_DETAIL,AMOUNT,TYPE,EMPLOYEE_RES,CUSTOM_TEL,DATE_RES)"
sql &= "Values (@GOODS_DETAIL,@AMOUNT,@TYPE,@EMPLOYEE_RES,@CUSTOM_TEL,@DATE_RES)"
command4 = New SqlCommand(str, connection4)
adapter = New SqlDataAdapter(command4)
For r As Integer = 0 To DataGridView1.RowCount - 1
With command3
.Parameters.AddWithValue("GOODS_DETAIL", DataGridView1.Rows(r).Cells(0).Value)
.Parameters.AddWithValue("AMOUNT", DataGridView1.Rows(r).Cells(1).Value)
.Parameters.AddWithValue("TYPE", DataGridView1.Rows(r).Cells(2).Value)
.Parameters.AddWithValue("EMPLOYEE_RES", CDbl(DataGridView1.Rows(r).Cells(3).Value))
.Parameters.AddWithValue("CUSTOM_TEL", CDbl(DataGridView1.Rows(r).Cells(4).Value))
.Parameters.AddWithValue("DATE_RES", DataGridView1.Rows(r).Cells(5).Value)
End With
command3.ExecuteNonQuery()
command3.Parameters.Clear()
Next
connection4.Close()
MessageBox.Show("บันทึกข้อมูลเรียบร้อยแล้ว", "ข้อความ", MessageBoxButtons.OK, MessageBoxIcon.None)
End Sub
|
|
|
|
|
Date :
2013-03-20 11:40:13 |
By :
5555 ไม่รู้อ่ะ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
มันทำไม่ได้อ่ะครับ รบกวนผู้รู้ช่วยบอกทีคับ
|
|
|
|
|
Date :
2013-03-20 11:43:53 |
By :
5555 ไม่รู้อ่ะ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|