syntax error in insert statement

arc^angel

New member
Joined
Jun 7, 2008
Messages
2
Programming Experience
Beginner
VB.NET:
Imports System.Data.OleDb
Imports System.Diagnostics.Debug

Public Class Form1
    Inherits Windows.Forms.Form


    Dim Debug As Diagnostics.Debug
    Dim da As New OleDb.OleDbDataAdapter("select * from MS2008", cn)
    Dim dt As DataTable = New DataTable
    Dim cmb As New OleDbCommandBuilder(da)
    Sub dodol()
        TextBox2.Text = False
        TextBox2.Clear()
        TextBox3.Text = False
        TextBox3.Clear()
        TextBox4.Text = False
        TextBox4.Clear()
        TextBox5.Text = False
        TextBox5.Clear()
        TextBox6.Text = False
        TextBox6.Clear()
        TextBox7.Text = False
        TextBox7.Clear()
        TextBox8.Text = False
        TextBox8.Clear()
        TextBox9.Text = False
        TextBox9.Clear()
        TextBox10.Text = False
        TextBox10.Clear()
        With TextBox1
            .ReadOnly = False
            .Clear()
            .Focus()
        End With
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim newrow As DataRow = dt.NewRow()
        newrow(0) = TextBox1.Text
        newrow(1) = TextBox2.Text
        newrow(2) = TextBox3.Text
        newrow(3) = TextBox4.Text
        newrow(4) = ComboBox1.SelectedItem
        newrow(5) = ComboBox2.SelectedItem
        newrow(6) = TextBox11.Text
        newrow(7) = TextBox5.Text
        newrow(8) = TextBox6.Text
        newrow(9) = TextBox7.Text
        newrow(10) = TextBox8.Text
        newrow(11) = TextBox9.Text
        newrow(12) = TextBox10.Text
        dt.Rows.Add(newrow)
        da.Update(dt)
        MsgBox("Berhasil Diinput")
        Button1.Enabled = False
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Button1.Enabled = True
        dodol()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        da.Fill(dt)
    End Sub
End Class

hi everyone, i am newbee in here
hope all of u can help me
i had a problem that i cant update my database .. actually i was using access 2003

when i tried to save my record from .exe to access , it would appear " syntax error in INSERT statement "

is anyone can help me to solve this problem..

i cant do it by myself coz it's very first time that i applied vb.net to merge..

hope u can understand my english language.. :p
coz i'm also learning the correct english :p

cmiiw
 
"INSERT statement" implies you have a SQL statement using the SQL keyword INSERT that fails a syntax check. I see no such SQL statement, I see no declaration of your connection string which would kinda help to see it, nor any comments. We can't help you if you don't help yourself... go see your teacher and get some professional help.
 
Youre making your life much harder than it needs be. Read the DW2 link in my signature, section on Creating a Simple Data App
 
Back
Top