 |
|
Code (VB.NET)
Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
Try
Dim sqlquery As String = "INSERT INTO MainGory(MainID, AmenityHead, AmenityDetail, PointN, ,StandardN, AmenityID, CategoryID) VALUES ('" & txtMainID.Text & "', '" & txtAmenDe.Text & "','" & txtDetail.Text & "','" & txtNum.Text & "','" & txtDIV.Text & "', '" & txtAM1.Text & "','" & txtCG1.Text & "')"
Dim sqlcommand As New OleDbCommand
With sqlcommand
.CommandText = sqlquery
.Connection = conn
.ExecuteNonQuery()
End With
MsgBox("บันทึกข้อมูลเรียบร้อยแล้วค่ะ", vbOKOnly, "Save Data")
txtAmenDe.Text = ""
txtDetail.Text = ""
txtNum.Text = ""
txtDIV.Text = ""
Dim cn As New System.Data.OleDb.OleDbConnection(connstring)
Dim da As New System.Data.OleDb.OleDbDataAdapter
Dim ds As New DataSet
Dim sql1 As String = "select * from MainGory"
da.SelectCommand = New System.Data.OleDb.OleDbCommand(sql1, cn)
da.Fill(ds, "MainGory")
DataGridView1.DataSource = ds.Tables("MainGory")
Catch ex As Exception
MsgBox(Err.Description)
End Try
End Sub
Error=syntax error insert into statement เราพลาดตรงไหนอะคะ
|
 |
 |
 |
 |
Date :
2013-05-10 20:55:29 |
By :
borobirt |
|
 |
 |
 |
 |
|
|
 |