|
![](/images/resource/spacer.gif) |
|
รันโปรแกรมแต่ติด Error Date-time รัน4หน้าก็เป็น4หน้าเลยคะ อันนี้ต้องแก้ไขยังไงคะ |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
![แจ้งError แจ้งError](https://www.thaicreate.com/upload/stock/20160917182951.jpg?v=1001)
ด้านล่างจะเป็นตัวอย่างโค้ดบันทึกสั้นๆค่ะ
Code (VB.NET)
Dim strInsert As String
Conn = New SqlConnection(conStr)
If Conn.State = ConnectionState.Closed Then
Conn.Open()
End If
strInsert = "insert into Billing(CustomerID, BillingID, BillingDate,Total)" & _
"values ('" & CID.Text & "','" & TextBox2.Text & "','" & DateTimePicker1.Value & "'," & TextBox7.Text & ")"
command = New SqlCommand(strInsert, Conn)
command.ExecuteNonQuery()
Dim DR As DataGridViewRow
For Each DR In DataGridView2.Rows
strInsert = "insert into BillingP(BillingID, Invoice, DateIV, Amount, Payment, Overdue )" & _
"values ('" & TextBox2.Text & "','" & DR.Cells(0).Value & "','" & CDate(DR.Cells(1).Value) & "'," & DR.Cells(2).Value & ",'" & DR.Cells(3).Value & "'," & DR.Cells(4).Value & ")"
command = New SqlCommand(strInsert, Conn)
command.ExecuteNonQuery()
Next
MsgBox("บันทึกข้อมูลเรียบร้อยแล้ว")
Tag : Ms SQL Server 2008, VB.NET, VS 2010 (.NET 4.x)
![](/images/adv.jpg?v=1001)
|
ประวัติการแก้ไข 2016-09-17 18:32:33 2016-09-17 19:00:07
|
![](/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 :
2016-09-17 18:31:30 |
By :
eitomiya |
View :
917 |
Reply :
1 |
|
![](/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) |
|
Format Date ผิดนะครับ ลองใช้เปนแบบ 19-Sep-2016 ครับ จะลดปัญหาเรื่องผิด Format ได้
|
![](/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 :
2016-09-19 10:00:47 |
By :
mr.win |
|
![](/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 00
|