|
![](/images/resource/spacer.gif) |
|
ขออนุญาตสอบถาม เรื่อง insert ขอมูลจาก listview to database ครับ VB.NET |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ปัญหาคือ ตอนนี้บันทึกแค่แถวเดียว ครับ ทั้งที่ข้อมูลมีหลายแถวครับ
มาขอคำแนะนำผู้รู้ครับผม
![โค๊ดที่ใช้ โค๊ดที่ใช้](https://www.thaicreate.com/upload/stock/20180913114150.png?v=1001)
Code (VB.NET)
Dim i As Integer
For i = 0 To ListView1.Items.Count - 1
sql = "insert into tb_ponewdetail (po_id,po_itemno,po_productpn,po_description,po_unit,po_qty,po_unitprice
,po_amount,po_date) values ('" & txt_autonumber.Text & "','" & ListView1.Items(i).SubItems(0).Text & "'
,'" & ListView1.Items(i).SubItems(1).Text & "','" & ListView1.Items(i).SubItems(2).Text & "'
,'" & ListView1.Items(i).SubItems(3).Text & "','" & ListView1.Items(i).SubItems(4).Text & "'
,'" & ListView1.Items(i).SubItems(5).Text & "','" & ListView1.Items(i).SubItems(6).Text & "'
,'" & txt_datenow.Text & "')"
Next
If cmd_excuteNonquery() = 0 Then
error_message("ไม่สำเร็จ")
Else
ok_message("สำเร็จ")
End If
Tag : .NET, Ms SQL Server 2012, VB.NET, Windows
![](/images/adv.jpg?v=1001)
|
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2018-09-13 11:45:19 |
By :
dododohua |
View :
830 |
Reply :
2 |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
เอา
Code (VB.NET)
If cmd_excuteNonquery() = 0 Then
error_message("ไม่สำเร็จ")
Else
ok_message("สำเร็จ")
End If
ไปใส่ใน for loop
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2018-09-13 12:07:46 |
By :
lamaka.tor |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 05
|