473,739 Members | 5,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

syntax error in INSERT INTO statement

i am using a dataset and a DataAdapter to update a table with the
following schema:
ResourceID
ProjectID
LastName
FirstName
Year
Nov
Dec
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct

i got the following error message:
syntax error in INSERT INTO statement

my code:
private System.Windows. Forms.Button btnProjectView;
private System.Data.Ole Db.OleDbConnect ion dcBUResourcesTr ackingOriginal;
private System.Data.Ole Db.OleDbConnect ion dcBUResourcesTr acking;
private DataGridTableSt yle dgrdTableStyle = new DataGridTableSt yle();
private void btnGetData_Clic k(object sender, System.EventArg s e)
{
daForecast.Fill ( dsResourceUsage );
}
private void btnUpdateData_C lick(object sender, System.EventArg s e)
{
try
{
daForecast.Upda te( dsResourceUsage );
}
catch (Exception ex)
{
Console.WriteLi ne( ex.Message );

Trace.WriteLine ( ex.Source );
Trace.WriteLine ( ex.StackTrace );
}
}

private void btnProjectView_ Click(object sender, System.EventArg s e)
{
frmProjectView projectView = new frmProjectView( );
projectView.Sho wDialog();
}

Any suggestions/fix with regards to the "syntax error in INSERT INTO
statement" (occured when I call the btnUpdateData_C lick() method) is
greatly appreciated.

William

Nov 13 '05 #1
3 4770


William wrote:
i am using a dataset and a DataAdapter to update a table with the
following schema:
ResourceID
ProjectID
LastName
FirstName
Year
Nov
Dec
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct

i got the following error message:
syntax error in INSERT INTO statement

my code:
private System.Windows. Forms.Button btnProjectView;
private System.Data.Ole Db.OleDbConnect ion dcBUResourcesTr ackingOriginal;
private System.Data.Ole Db.OleDbConnect ion dcBUResourcesTr acking;
private DataGridTableSt yle dgrdTableStyle = new DataGridTableSt yle();
private void btnGetData_Clic k(object sender, System.EventArg s e)
{
daForecast.Fill ( dsResourceUsage );
}
private void btnUpdateData_C lick(object sender, System.EventArg s e)
{
try
{
daForecast.Upda te( dsResourceUsage );
}
catch (Exception ex)
{
Console.WriteLi ne( ex.Message );

Trace.WriteLine ( ex.Source );
Trace.WriteLine ( ex.StackTrace );
}
}

private void btnProjectView_ Click(object sender, System.EventArg s e)
{
frmProjectView projectView = new frmProjectView( );
projectView.Sho wDialog();
}

Any suggestions/fix with regards to the "syntax error in INSERT INTO
statement" (occured when I call the btnUpdateData_C lick() method) is
greatly appreciated.

William


Where's your code for populating the dsResourceUsage dataset? We need
SQL to work with.

Edward

Nov 13 '05 #2
SELECT ResourceID, ProjectID, LastName, FirstName, Year, Nov, Dec,
Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct
FROM Forecast
On Wed, 1 Jun 2005 te********@hotm ail.com wrote:


William wrote:
i am using a dataset and a DataAdapter to update a table with the
following schema:
ResourceID
ProjectID
LastName
FirstName
Year
Nov
Dec
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct

i got the following error message:
syntax error in INSERT INTO statement

my code:
private System.Windows. Forms.Button btnProjectView;
private System.Data.Ole Db.OleDbConnect ion dcBUResourcesTr ackingOriginal;
private System.Data.Ole Db.OleDbConnect ion dcBUResourcesTr acking;
private DataGridTableSt yle dgrdTableStyle = new DataGridTableSt yle();
private void btnGetData_Clic k(object sender, System.EventArg s e)
{
daForecast.Fill ( dsResourceUsage );
}
private void btnUpdateData_C lick(object sender, System.EventArg s e)
{
try
{
daForecast.Upda te( dsResourceUsage );
}
catch (Exception ex)
{
Console.WriteLi ne( ex.Message );

Trace.WriteLine ( ex.Source );
Trace.WriteLine ( ex.StackTrace );
}
}

private void btnProjectView_ Click(object sender, System.EventArg s e)
{
frmProjectView projectView = new frmProjectView( );
projectView.Sho wDialog();
}

Any suggestions/fix with regards to the "syntax error in INSERT INTO
statement" (occured when I call the btnUpdateData_C lick() method) is
greatly appreciated.

William


Where's your code for populating the dsResourceUsage dataset? We need
SQL to work with.

Edward

Nov 13 '05 #3
"William" <wh******@stude nt.cs.uwaterloo .ca> wrote in message
news:Pi******** *************** ********@cpu08. student.cs.uwat erloo.ca...
SELECT ResourceID, ProjectID, LastName, FirstName, Year, Nov, Dec,
Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct
FROM Forecast
On Wed, 1 Jun 2005 te********@hotm ail.com wrote:


William wrote:
> i am using a dataset and a DataAdapter to update a table with the
> following schema:
> ResourceID
> ProjectID
> LastName
> FirstName
> Year
> Nov
> Dec
> Jan
> Feb
> Mar
> Apr
> May
> Jun
> Jul
> Aug
> Sep
> Oct
>
> i got the following error message:
> syntax error in INSERT INTO statement
>
> my code:
> private System.Windows. Forms.Button btnProjectView;
> private System.Data.Ole Db.OleDbConnect ion
> dcBUResourcesTr ackingOriginal;
> private System.Data.Ole Db.OleDbConnect ion dcBUResourcesTr acking;
> private DataGridTableSt yle dgrdTableStyle = new DataGridTableSt yle();
>
>
> private void btnGetData_Clic k(object sender, System.EventArg s e)
> {
> daForecast.Fill ( dsResourceUsage );
> }
>
>
> private void btnUpdateData_C lick(object sender, System.EventArg s e)
> {
> try
> {
> daForecast.Upda te( dsResourceUsage );
> }
> catch (Exception ex)
> {
> Console.WriteLi ne( ex.Message );
>
> Trace.WriteLine ( ex.Source );
> Trace.WriteLine ( ex.StackTrace );
> }
> }
>
> private void btnProjectView_ Click(object sender, System.EventArg s e)
> {
> frmProjectView projectView = new frmProjectView( );
> projectView.Sho wDialog();
> }
>
> Any suggestions/fix with regards to the "syntax error in INSERT INTO
> statement" (occured when I call the btnUpdateData_C lick() method) is
> greatly appreciated.
>
> William


Where's your code for populating the dsResourceUsage dataset? We need
SQL to work with.

Edward

This isn't really the right newsgroup for this question as it has almost
nothing to do with Access. The fact that it might use an mdb file is not
really relavant. The ADO.NET object model involves a DataAdapter object
which has InsertCommand, UpdateCommand and DeleteCommand properties. You
can code these yourself or use a CommandBuilder object to get them done for
you although I'm sure it helps if the table has a single field to easily
identify the primary key.
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2214
by: Gérard Leclercq | last post by:
ACCESS First fields are TEXT, last 2 are Numbers The name of the fields are correct. Dim MyConn Set MyConn=Server.CreateObject("ADODB.Connection") MyConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath ("/xdata/sc.mdb")
4
18058
by: dcarson | last post by:
I've read about this error in several other discussions, but still can't seem to pinpoint the problem with my code. Everything seemed to be working fine for some time, but it now tends to bomb out on me for some reason. The Summary field is pulled from a Rich Text Editor that allows HTML formatting and appears to be the culprit, but I just can't seem to figure out why. Any guidance is greatly appreciated. I'm connecting to an Access...
7
6671
by: kosta | last post by:
hello! one of my forms communicates with a database, and is supposed to add a row to a table using an Insert statement... however, I get a 'oledb - syntax error' exception... I have double checked, and the insert works fine (tried to use it from access)... im using visual C# express 2k5... what could be wrong? thanks!
2
1599
by: eric dugal | last post by:
Hi all!! I need your help.... i'm working since 2 hours on a simple insert statement, but couldn't handle it. Here is my code : public int ExecQuery(string SqlString) {
3
2821
by: Neil Zanella | last post by:
Hello, I am trying to execute ADO.NET INSERT statement where one of the fields is coming from a password HTML control. When I access the text with password.Value and print with Response.Write so as to check that it is working correctly it displays just fine. However, whenever I include the password field in one of the SQL INSERT statement's fields I get the following error:
3
2496
by: Nathan Sokalski | last post by:
When trying to submit data to an Access database using ASP.NET I recieve the following error: System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) +41 System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +174 System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +92
5
2143
by: amitbadgi | last post by:
Hi guys, I am getting the following error in teh insert statement , I am converting this asp application to asp.net, here is teh error, Exception Details: System.Runtime.InteropServices.COMException: Syntax error in INSERT INTO statement. Source Error: Line 118: MM_editCmd.ActiveConnection = MM_editConnection
2
2811
by: RSH | last post by:
I have a rather simple script that transfers data from a SQL server database to an Access database. The procedure is intended to be dynamic so I am basically adding a datarow and then passing the data with a simple loop. I am using OleDbCommandbuilder to build the INSERT command but for some reason when it gets to a particular table in the database it errors out giving me "Syntax Error in INSERT INTO Statement". The cmmandbuilder built...
6
6002
by: ewpatton | last post by:
Good day, I've been trying to work with SQL and an Access database in order to handle custom user profiles. I haven't had any trouble reading from my database, but inserting new entries into it has been troublesome to say the least. My ASP.NET script is supposed to execute an INSERT INTO statement in order to add a user to the database. Here is a sample:
0
8969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8792
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9337
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9209
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8215
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6754
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3280
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.