|
|
 |
| 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.
|
 |

June 2nd, 2006, 02:13 PM
|
|
Authorized User
|
|
Join Date: Dec 2005
Location: , , Yugoslavia.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

June 2nd, 2006, 02:17 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,000
Thanks: 5
Thanked 37 Times in 36 Posts
|
|
hi there..
shouldn't be VALUES instead of VALUE????
HTH
Gonzalo
|

June 2nd, 2006, 03:15 PM
|
|
Authorized User
|
|
Join Date: Dec 2005
Location: , , Yugoslavia.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have tried this again I am getting the same error. Other suggestion???
|

June 2nd, 2006, 03:22 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Location: , , .
Posts: 559
Thanks: 6
Thanked 1 Time in 1 Post
|
|
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.
|

June 2nd, 2006, 04:12 PM
|
|
Authorized User
|
|
Join Date: Dec 2005
Location: , , Yugoslavia.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you very much I finished it I completed. Do you want me to insert the complete code to see it??
|

June 2nd, 2006, 04:57 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Location: , , .
Posts: 559
Thanks: 6
Thanked 1 Time in 1 Post
|
|
Yes, I would appreciate know what the solution was.
Thank you.
|

June 2nd, 2006, 05:01 PM
|
|
Authorized User
|
|
Join Date: Dec 2005
Location: , , Yugoslavia.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |