INSERT INTO error?
INSERT INTO error?
INSERT INTO error?
INSERT INTO error?
INSERT INTO error?
INSERT INTO error? INSERT INTO error? INSERT INTO error? INSERT INTO error? INSERT INTO error? INSERT INTO error? INSERT INTO error? INSERT INTO error?
INSERT INTO error? INSERT INTO error?
INSERT INTO error?
Go Back  Xtreme Visual Basic Talk > > > INSERT INTO error?


Reply
 
Thread Tools Display Modes
  #1  
Old 08-27-2013, 10:45 AM
HuntingCode HuntingCode is offline
Newcomer
 
Join Date: Aug 2013
Posts: 3
Default INSERT INTO error?


This is the error I am getting:

An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll

Additional information: Syntax error in INSERT INTO statement.

And here is the code where this is halting at (bold line):

Code:
Private Sub btnCommit_Click(sender As Object, e As EventArgs) Handles btnCommit.Click
        If inc <> -1 Then
            Dim cb As New OleDb.OleDbCommandBuilder(da)
            Dim dsNewRow As DataRow
            dsNewRow = ds.Tables("AddressBookDB").NewRow()
            dsNewRow.Item("Name") = TextBox1.Text
            dsNewRow.Item("Street Address") = TextBox2.Text
            dsNewRow.Item("City, State, Zip") = TextBox3.Text
            dsNewRow.Item("Home Phone") = TextBox4.Text
            dsNewRow.Item("Mobile Phone") = TextBox5.Text
            dsNewRow.Item("Other Phone") = TextBox6.Text
            dsNewRow.Item("E-mail Address") = TextBox7.Text
            ds.Tables("AddressBookDB").Rows.Add(dsNewRow)
            da.Update(ds, "AddressBookDB")
            MsgBox("New Record added to the Database")
            btnCommit.Enabled = False
            btnAddNew.Enabled = True
            btnUpdate.Enabled = True
            btnDelete.Enabled = True
        End If
    End Sub
Anybody have any ideas why this is happening?
Reply With Quote
  #2  
Old 09-04-2013, 10:24 PM
PeetSoft's Avatar
PeetSoft PeetSoft is offline
Centurion
 
Join Date: Jun 2003
Location: HHW - the Netherlands
Posts: 184
Default

Don't see any mistakes here so soon.
It might be the data your entering, like a name with a single quote in it....
__________________
-----------------------------------------------------
If debugging is the art of removing bugs, then
programming must be the art of inserting them.
I do comply with Flyguy's signature (If he still had one)
Reply With Quote
  #3  
Old 01-02-2014, 11:36 PM
JD_FAN JD_FAN is offline
Newcomer
 
Join Date: Jan 2014
Posts: 3
Default

I was wondering if this was ever resolved. I am having the same issue and I know it is because of the space in the field name. Unfortunately, I can not rename the fields in my project so they do not contain spaces. You may be able to.

In the mean time I am still looking for a solution so if you found one let me know
Reply With Quote
  #4  
Old 02-07-2014, 07:36 AM
CharlieMay's Avatar
CharlieMay CharlieMay is offline
Regular
 
Join Date: Sep 2009
Location: Indiana
Posts: 89
Default

The solution can be found here
__________________
I thought I knew what I was doing...
...And then I turned on Option Strict
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
INSERT INTO error?
INSERT INTO error?
INSERT INTO error? INSERT INTO error?
INSERT INTO error?
INSERT INTO error?
INSERT INTO error? INSERT INTO error? INSERT INTO error? INSERT INTO error? INSERT INTO error? INSERT INTO error? INSERT INTO error?
INSERT INTO error?
INSERT INTO error?
 
INSERT INTO error?
INSERT INTO error?
 
-->