 |
|
รบกวนช่วยเขียนคำสั่ง SQL ให้หน่อยครับ ติดมา2วันแล้วยังไม่ผ่านจริงๆครับผม |
|
 |
|
|
 |
 |
|
เห้อผลสรุปได้แล้วครับ ผมเขียนถูกแต่แรกแล้วแหละ แต่ SQL SERVER เครื่อง PC ผมมีปัญหา
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Servicebilldetail_Servicebill". The conflict occurred in database "Carcare", table "dbo.Servicebill", column 'Servicebill_id'.
The statement has been terminated.
บ้าอะไรไม่รุ้เนี้ย
แต่เอาไปรันใน Notebook OK ครับทำงานได้แล้ว
Code (VB.NET)
If ServicebilldetailDataGridView1.Rows(i).Cells(5).Value IsNot Nothing Then
Dim id As String = ServicebilldetailDataGridView1.Rows(i).Cells(5).Value.ToString()
Dim strselectDEL As String = "insert into Servicebilldetail (Servicebilldetail_id,ServicebillMenu_id,Servicebill_id,Servicebilldetai_name,Servicebilldetai_price) values ('" + ServicebilldetailDataGridView1.Rows(i).Cells(0).Value.ToString + "','" _
+ ServicebilldetailDataGridView1.Rows(i).Cells(2).Value.ToString + "','" + ServicebilldetailDataGridView1.Rows(i).Cells(1).Value.ToString + "','" + ServicebilldetailDataGridView1.Rows(i).Cells(3).Value.ToString + "','" + ServicebilldetailDataGridView1.Rows(i).Cells(4).Value.ToString + "')"
com.CommandType = CommandType.Text
com.CommandText = strselectDEL
com.Connection = con
com.ExecuteNonQuery() '
MsgBox("OK")
End If
Next
|
ประวัติการแก้ไข 2012-07-20 22:48:50
 |
 |
 |
 |
Date :
2012-07-20 22:45:03 |
By :
billkyz5 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2012-07-21 20:38:11 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
รบกวนถามครับ แทบตรงเมนูข้ามบนใน tool อะไรอ่ะครับ สวยดี ........ ตรงกลมๆ กลับ ปุ่ม Add
|
 |
 |
 |
 |
Date :
2012-07-24 10:08:35 |
By :
minihero-t |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ribbon หรือเปล่า
https://www.thaicreate.com/dotnet/forum/052060.html
|
 |
 |
 |
 |
Date :
2012-07-24 10:13:52 |
By :
อิอิ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อ่อมีครับ ไม่กำหนด กำหนดเป็นหมดครับผม ผมเลยยก Database ลง Notbook ซึ่งทำงานปกติครับ
เออแต่ว่า PC หนะมันไม่มีหรอกครับ แต่ Sql มีครับ ลองลบแล้ว พอลงใหม่กลับไม่ผ่าน แก้โดยล้างเครื่องไหม่เลย ตอนนี้ปรกติครับผม
|
 |
 |
 |
 |
Date :
2012-07-24 11:12:55 |
By :
billkyz5 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|