syntax fout bij insert

Status
Niet open voor verdere reacties.

paulus4605

Gebruiker
Lid geworden
2 mrt 2013
Berichten
28
Beste als ik onderstaande code uitvoer krijg ik een syntax fout bij insert, en ik zie niet wat ik verkeerd doe
cbx staat voor combobox rdb is radiobutton
de fout krijg ik hier acscmd.ExecuteNonQuery() als ik de debug doe op de gegevens die ik invoer ziet alles er ok uit



[CPP]
Imports System.Data.OleDb

Module modCon
Public acsconn As New OleDb.OleDbConnection
Public acsdr As OleDbDataReader
Public acsda As New OleDbDataAdapter
Public strsql As String

Sub connect()
acsconn.ConnectionString = "Provider=Microsoft.Ace.Oledb.12.0; Data Source=|datadirectory|\telelink.accdb; persist security info=false;"
acsconn.Open()
If acsconn.State = ConnectionState.Open Then
MsgBox("Connected")
End If
End Sub
End Module
Private Sub BtnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAdd.Click
'sqlstatements
strsql = "insert into TelelinkTable (Datum, ContactPerson, ContactPhone, IsaAbo, IsaAdminUser, Os, Os64, Office, Of64, InstallType, Remarks) values ('" _
& DateTimePicker1.Text & "','" _
& txtContact.Text & "','" _
& txtPhone.Text & "','" _
& txtIsaAbo.Text & "','" _
& TxtIsaAdmin.Text & "','" _
& CbxOs.Text & "','" _
& RdbOs64.Text & "','" _
& CbxOffice.Text & "','" _
& RdbOf64.Text & "','" _
& CbxInstal.Text & "','" _
& txtRemark.Text & "')"

Dim acscmd As New OleDb.OleDbCommand ' the oledbcommand
acscmd.CommandText = strsql 'sets the sql string
acscmd.Connection = acsconn 'sets the connection to use the oledbcommand
acscmd.ExecuteNonQuery() ' execute oledb commands non query only
acscmd.Dispose()
MsgBox("Saved")
End Sub
[/CPP]
>>edit
heb het probleem gevonden het datum veld in de accdb was foutief gedeclareerd
 
Laatst bewerkt:
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan