Wrox Programmer Forums
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 9th, 2009, 01:00 PM
Authorized User
 
Join Date: Jun 2009
Posts: 30
Thanks: 13
Thanked 0 Times in 0 Posts
Default Insert statement

Hi.....i did insert statement and encountered error......but could not solve it..this is the error.....can anybody correct it?

Error Message: Incorrect syntax near '@job_intro'.
this is my code...

SqlConnection con;
string insertStr;
SqlCommand cmdInsert;
String constr = ConfigurationManager.ConnectionStrings["tarStreetConnectionString1"].ConnectionString;
con =
newSqlConnection(constr);
con.Open();
insertStr =
"Insert Into JobPost(Job_Id,Job_Desc,Job_Specialization,Job_Min Qualification,Job_PositionLevel,Job_Title,Job_CmpN ame,Job_Location,Job_Employment,YrsOfExperience,Jo b_CmpIntroduction)Values(@id,@desc,@Special,@min_Q ua,@position,@title,@cmpName,@location,@job_Employ ,@yrsExpe,@job_intro";
cmdInsert =
newSqlCommand(insertStr, con);
cmdInsert.Parameters.AddWithValue(
"@id", TextBox17.Text);
cmdInsert.Parameters.AddWithValue(
"@desc",TextBox9.Text);
cmdInsert.Parameters.AddWithValue(
"@Special",DropDownList6.SelectedItem.Text);
cmdInsert.Parameters.AddWithValue(
"@min_Qua",ListBox1.SelectedItem.Text);
cmdInsert.Parameters.AddWithValue(
"@position",DropDownList5.SelectedItem.Text);
cmdInsert.Parameters.AddWithValue(
"@title",txtPosition.Text);
cmdInsert.Parameters.AddWithValue(
"@cmpName",TextBox10.Text);
cmdInsert.Parameters.AddWithValue(
"@location",DropDownList8.SelectedItem.Text);
cmdInsert.Parameters.AddWithValue(
"@job_Employ",CheckBoxList1.SelectedItem.Text);
cmdInsert.Parameters.AddWithValue(
"@yrsExpe",TextBox7.Text);
cmdInsert.Parameters.AddWithValue(
"@job_intro", TextBox11.Text);
//cmdInsert.Parameters.AddWithValue("@job_candidate" ,);
cmdInsert.ExecuteNonQuery();
con.Close();
}

 
Old August 9th, 2009, 01:51 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Well.. you could always close )))) (you missed one of them after Job_intro)
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
The Following User Says Thank You to gbianchi For This Useful Post:
Banishah (August 9th, 2009)





Similar Threads
Thread Thread Starter Forum Replies Last Post
insert and/or update statement carswelljr SQL Language 3 September 28th, 2006 10:03 AM
Problem With INSERT Statement len1591 ASP.NET 2.0 Basics 3 May 19th, 2006 12:14 PM
Insert Statement Iashia06 Access 0 April 7th, 2006 12:45 PM
complex insert statement? qwjunk SQL Server 2000 3 November 2nd, 2004 04:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.