p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 2nd, 2006, 02:13 PM
Authorized User
 
Join Date: Dec 2005
Location: , , Yugoslavia.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default NEED HELP INSERT INTO statement syntax error

 Please I need help with this error. I dont know what to do



SQL statement:

string reg;
         reg = "INSERT INTO Customer(Name, Surname,User, Pass, Address1, Email1)";
         reg += " VALUE('" +first.Text+ "','" +second.Text+ "','" +user.Text+ "','" +pass.Text+ "','" +address1.Text+ "','" +email.Text+ "');";









Exception Details: System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.

Source Error:

Line 35:
Line 36: connection.Open();
Line 37: command.ExecuteNonQuery();
Line 38:
Line 39: Response.Redirect("product.aspx");


Source File: c:\Application development website\links\register.aspx Line: 37

Stack Trace:

[OleDbException (0x80040e14): Syntax error in INSERT INTO statement.]
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS dbParams, Object& executeResult) +177
   System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult) +194
   System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior, Object& executeResult) +56
   System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior behavior, String method) +105
   System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +89
   ASP.register_aspx.register_click(Object sender, EventArgs e) in c:\Application development website\links\register.aspx:37
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +75
   System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +97
   System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4919



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old June 2nd, 2006, 02:17 PM
Friend of Wrox
Points: 6,570, Level: 34
Points: 6,570, Level: 34 Points: 6,570, Level: 34 Points: 6,570, Level: 34
Activity: 43%
Activity: 43% Activity: 43% Activity: 43%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,000
Thanks: 5
Thanked 37 Times in 36 Posts
Send a message via MSN to gbianchi
Default

hi there..

shouldn't be VALUES instead of VALUE????

HTH

Gonzalo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old June 2nd, 2006, 03:15 PM
Authorized User
 
Join Date: Dec 2005
Location: , , Yugoslavia.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have tried this again I am getting the same error. Other suggestion???

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old June 2nd, 2006, 03:22 PM
Friend of Wrox
Points: 1,890, Level: 17
Points: 1,890, Level: 17 Points: 1,890, Level: 17 Points: 1,890, Level: 17
Activity: 7%
Activity: 7% Activity: 7% Activity: 7%
 
Join Date: Jul 2003
Location: , , .
Posts: 559
Thanks: 6
Thanked 1 Time in 1 Post
Default

It has to be VALUES. There is some other error there. I wouldn't use the + . Use & instead. Debug and post your SQL statement here.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old June 2nd, 2006, 04:12 PM
Authorized User
 
Join Date: Dec 2005
Location: , , Yugoslavia.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much I finished it I completed. Do you want me to insert the complete code to see it??

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #6 (permalink)  
Old June 2nd, 2006, 04:57 PM
Friend of Wrox
Points: 1,890, Level: 17
Points: 1,890, Level: 17 Points: 1,890, Level: 17 Points: 1,890, Level: 17
Activity: 7%
Activity: 7% Activity: 7% Activity: 7%
 
Join Date: Jul 2003
Location: , , .
Posts: 559
Thanks: 6
Thanked 1 Time in 1 Post
Default

Yes, I would appreciate know what the solution was.

Thank you.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #7 (permalink)  
Old June 2nd, 2006, 05:01 PM
Authorized User
 
Join Date: Dec 2005
Location: , , Yugoslavia.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Complete solution:


 public void register_click(object sender, EventArgs e)
     { //I have changed this part as defined in my report because there was no availability of using XML file in the Computer Suite

         OleDbConnection connection = new OleDbConnection();
         string dbconn;
         dbconn = "Provider=Microsoft.Jet.OLEDB.4.0;";
         dbconn += "Data Source= " + HttpContext.Current.Server.MapPath("accessMyWebsit e.mdb");
         connection.ConnectionString = dbconn;



         // insert data into registration table

         string reg;
         reg = "INSERT INTO Customer([Name], [Surname], [User], [Pass], [Address1], [Email1])";
         reg += " VALUES ('" +first.Text+ "','" +second.Text+ "','" +user.Text+ "','" +pass.Text+ "','" +address1.Text+ "','" +email.Text+ "');";

         //Define ADO.NET objects
         OleDbCommand command = new OleDbCommand();
         command.CommandText = reg;
         command.Connection = connection;

         connection.Open();

          command.ExecuteNonQuery();

         Response.Redirect("login.aspx");

         connection.Close();
     }

Thanks to all that contributed


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax error in INSERT INTO statement Stephan BOOK: Beginning JavaScript 16 February 22nd, 2005 01:43 PM
Syntax error in INSERT INTO statement mega ASP.NET 1.0 and 1.1 Basics 3 January 12th, 2005 04:30 PM
Syntax error in INSERT INTO statement evol77 ASP.NET 1.1 2 December 17th, 2004 06:15 AM
Syntax error in INSERT INTO statement. askaggs Classic ASP Databases 5 June 10th, 2004 01:21 AM
Syntax error in INSERT INTO statement sankar ASP.NET 1.1 9 May 20th, 2004 03:48 PM



All times are GMT -4. The time now is 05:42 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc