 |
|
อธิบายก่อนนะคับ
VB2008
Access 2003
Insert ข้อมูลแล้วมันแจ้ง Syntex Error ก็พอรู้ว่าโค้ดผิด แต่ งง ว่าผิดตรงไหน ? อยากเช็ดดูหน่อยครับ เพราะ นี้เป็นครั้งแรกที่ใช้ VB2008 กับ Access ตอนนี้ติดแค่ Syntex ครับ ผมอยากลองแค่ให้ข้อมูลสามารถนำเข้าได้ก่อน
Code (VB.NET)
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Dim cnn As New System.Data.OleDb.OleDbConnection
cnn.ConnectionString = ConDB.OleDBcon
cnn.Open()
Dim cmd As New System.Data.OleDb.OleDbCommand
cmd.Connection = cnn
cmd.CommandText = "insert into invoice(invoice_id, order_id, customer_id, no, product_id, product_name, unit, cost, dayout) values ('" & txtInvoiceno.Text & "','" & txtOrderno.Text & "','" & txtCustomerID.Text & "', '1' ,'" & txtProductID1.Text & "','" & txtProduct1.Text & "','" & txtUnit1.Text & "','" & txtCost1.Text & "','" & dtpDay.Text & "');"
cmd.ExecuteNonQuery()
cnn.Close()
MessageBox.Show("บันทึกข้อมูลเรียบร้อยแล้ว")
End Sub
ขอบคุณล่วงหน้าครับ
Tag : .NET, Ms Access, VS 2008 (.NET 3.x)
|
|
 |
 |
 |
 |
Date :
2012-07-25 00:39:31 |
By :
DemonXIII |
View :
1201 |
Reply :
6 |
|
 |
 |
 |
 |
|
|
|
 |