473,473 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Create 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.OleDb.OleDbConnection dcBUResourcesTrackingOriginal;
private System.Data.OleDb.OleDbConnection dcBUResourcesTracking;
private DataGridTableStyle dgrdTableStyle = new DataGridTableStyle();
private void btnGetData_Click(object sender, System.EventArgs e)
{
daForecast.Fill( dsResourceUsage );
}
private void btnUpdateData_Click(object sender, System.EventArgs e)
{
try
{
daForecast.Update( dsResourceUsage );
}
catch (Exception ex)
{
Console.WriteLine( ex.Message );

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

private void btnProjectView_Click(object sender, System.EventArgs e)
{
frmProjectView projectView = new frmProjectView();
projectView.ShowDialog();
}

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

William

Nov 13 '05 #1
3 4739


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.OleDb.OleDbConnection dcBUResourcesTrackingOriginal;
private System.Data.OleDb.OleDbConnection dcBUResourcesTracking;
private DataGridTableStyle dgrdTableStyle = new DataGridTableStyle();
private void btnGetData_Click(object sender, System.EventArgs e)
{
daForecast.Fill( dsResourceUsage );
}
private void btnUpdateData_Click(object sender, System.EventArgs e)
{
try
{
daForecast.Update( dsResourceUsage );
}
catch (Exception ex)
{
Console.WriteLine( ex.Message );

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

private void btnProjectView_Click(object sender, System.EventArgs e)
{
frmProjectView projectView = new frmProjectView();
projectView.ShowDialog();
}

Any suggestions/fix with regards to the "syntax error in INSERT INTO
statement" (occured when I call the btnUpdateData_Click() 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********@hotmail.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.OleDb.OleDbConnection dcBUResourcesTrackingOriginal;
private System.Data.OleDb.OleDbConnection dcBUResourcesTracking;
private DataGridTableStyle dgrdTableStyle = new DataGridTableStyle();
private void btnGetData_Click(object sender, System.EventArgs e)
{
daForecast.Fill( dsResourceUsage );
}
private void btnUpdateData_Click(object sender, System.EventArgs e)
{
try
{
daForecast.Update( dsResourceUsage );
}
catch (Exception ex)
{
Console.WriteLine( ex.Message );

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

private void btnProjectView_Click(object sender, System.EventArgs e)
{
frmProjectView projectView = new frmProjectView();
projectView.ShowDialog();
}

Any suggestions/fix with regards to the "syntax error in INSERT INTO
statement" (occured when I call the btnUpdateData_Click() 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******@student.cs.uwaterloo.ca> wrote in message
news:Pi*******************************@cpu08.stude nt.cs.uwaterloo.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********@hotmail.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.OleDb.OleDbConnection
> dcBUResourcesTrackingOriginal;
> private System.Data.OleDb.OleDbConnection dcBUResourcesTracking;
> private DataGridTableStyle dgrdTableStyle = new DataGridTableStyle();
>
>
> private void btnGetData_Click(object sender, System.EventArgs e)
> {
> daForecast.Fill( dsResourceUsage );
> }
>
>
> private void btnUpdateData_Click(object sender, System.EventArgs e)
> {
> try
> {
> daForecast.Update( dsResourceUsage );
> }
> catch (Exception ex)
> {
> Console.WriteLine( ex.Message );
>
> Trace.WriteLine( ex.Source );
> Trace.WriteLine( ex.StackTrace );
> }
> }
>
> private void btnProjectView_Click(object sender, System.EventArgs e)
> {
> frmProjectView projectView = new frmProjectView();
> projectView.ShowDialog();
> }
>
> Any suggestions/fix with regards to the "syntax error in INSERT INTO
> statement" (occured when I call the btnUpdateData_Click() 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
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...
4
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...
7
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...
2
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
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...
3
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...
5
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:...
2
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...
6
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...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.