 |
|
ช่วยดูให้หน่อยครับ เกี่ยวกับการดึงข้อมูลจาก Datagrid อีกฟอร์ม มาบันทึกข้อมูลวันที่ลง MySQL ครับ |
|
 |
|
|
 |
 |
|
ผมอยากจะ insert ข้อมูลลง mysql โดยการดึงข้อมูลจากอีกตารางที่เป็น date มา insert น่ะครับ



พอ insert ลงไปกลับเป็นค่า 0 ไม่ตรงกับข้อมูลวันที่ insert ลงไปครับ ช่วยดูให้หน่อยครับ
Code (VB.NET)
Private Sub DataGridView1_CellMouseDoubleClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseDoubleClick
Dim i As Integer
i = DataGridView1.CurrentRow.Index
Dim B_ID As Integer
Dim D_ID As Date
B_ID = Convert.ToUInt32(DataGridView1.Item(1, i).Value)
D_ID = (DataGridView1.Item(8, i).Value)
StrSQL = "INSERT INTO renttmp1(Barcode_ID,DateEnd,DateOver)VALUES(" & B_ID & "," & D_ID & ", NOW())"
ds = New DataSet
da = New MySqlDataAdapter(StrSQL, MySQLConn)
da.Fill(ds, "renttmp1")
MySQLConn.Close()
Me.Close()
End Sub
Tag : .NET, MySQL, Win (Windows App), VB.NET, VS 2012 (.NET 4.x)
|
|
 |
 |
 |
 |
Date :
2015-11-11 03:33:16 |
By :
Jamesillion |
View :
1193 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลอง alert (DataGridView1.Item(8, i).Value) มาดูครับ
แต่ ", NOW())" นิน่าจะเป็น ", " & NOW() & ")" นะครับ
|
 |
 |
 |
 |
Date :
2015-11-11 08:19:37 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|