|
|
ช่วยแก้ Error : Syntax error in INSERT INTO statement. ด้วยค่ะ |
|
|
|
|
|
|
|
error ตรง command.ExecuteNonQuery() ค่ะ ในตารางฐานข้อมูล Access เป็นชนิด ShotText หมดเลยค่ะ
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
sql = "INSERT INTO Withdraw(Withdraw_id,date,Doc_id,Emp_id,Emp_name,Department,Factory,Position) VALUES( @Withdraw_id,@date,@Doc_id,@Emp_id,@Emp_name,@Department,@Factory,@Position)"
command = New OleDbCommand(sql, connection)
command.Parameters.AddWithValue("Withdraw_id", txtID.Text)
command.Parameters.AddWithValue("date", DateTimePicker1.Text.ToString)
command.Parameters.AddWithValue("Doc_id", txtDoc_id.Text)
command.Parameters.AddWithValue("Emp_id", txtEmp_id.Text)
command.Parameters.AddWithValue("Emp_name", txtEmp_Name.Text)
command.Parameters.AddWithValue("Department", CDep.Text)
command.Parameters.AddWithValue("Factory", Cfac.Text)
command.Parameters.AddWithValue("Position", txtPos.Text)
command.ExecuteNonQuery()
MsgBox("บันทึกแล้ว")
DateTimePicker1.Enabled = False
txtID.Enabled = False
txtDoc_id.Enabled = False
txtEmp_id.Enabled = False
txtEmp_Name.Enabled = False
CDep.Enabled = False
Cfac.Enabled = False
txtPos.Enabled = False
txtID.Clear()
txtDoc_id.Clear()
txtEmp_id.Clear()
txtEmp_Name.Clear()
CDep.SelectedIndex = -1
Cfac.SelectedIndex = -1
txtPos.Clear()
btnAdd.Enabled = True
btnDelete.Enabled = True
btnSave.Enabled = False
count = 0
MaxID()
Showdata()
End Sub
Tag : Ms Access
|
|
|
|
|
|
Date :
2019-10-07 11:48:59 |
By :
Choo669696 |
View :
571 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2019-10-07 12:25:22 |
By :
Choo669696 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|