---------- Forwarded message ----------
From: praveen singh <[email protected]>
Date: Thu, Sep 22, 2011 at 4:30 PM
Subject: Please solve this error
To: [email protected]
I have the code that is:-
protected void btn_Submit_Click(object sender, EventArgs e)
{
ocn.Open();
OleDbCommand ocmd =
new OleDbCommand("insert into tbl_regform
(Name,Email,Password,Mo_Isdcode,MobileNo,LL_Isdcode,LL_Stdcode,LandLineNo,ResumeUrl,ExpYear,ExpMonth,Location,FunctionalArea,DateOfSubmit)
values(@Name,@Email,@Password,@Mo_Isdcode,@MobileNo,@LL_Isdcode,@LL_Stdcode,@LandLineNo,@ResumeUrl,@ExpYear,@ExpMonth,@Location,@FunctionalArea,@DateOfSubmit)",
ocn);
ocmd.Parameters.AddWithValue(
"@Name", txt_Name.Text);
ocmd.Parameters.AddWithValue(
"@Email", txt_Email.Text);
ocmd.Parameters.AddWithValue(
"@Password", txt_Password.Text);
ocmd.Parameters.AddWithValue(
"@Mo_Isdcode", txt_IsdMoCode.Text);
ocmd.Parameters.AddWithValue(
"@MobileNo", txt_Mobile.Text);
ocmd.Parameters.AddWithValue(
"@LL_Isdcode", txt_IsdTelCode.Text);
ocmd.Parameters.AddWithValue(
"@LL_Stdcode", txt_StdCode.Text);
ocmd.Parameters.AddWithValue(
"@LandLineNo", txt_LandLineNo.Text);
if (fu_Resume.PostedFile.FileName != "")
{
string extention, reg_id, userid, date, ResumeUrl;
int index1, count, count1;
index1 = txt_Email.Text.IndexOf(
"@");
userid = txt_Email.Text.Substring(
0, index1);
userid = userid.Replace(
".", "");
count = userid.Length;
date = DateTime.Now.ToShortDateString().Replace(
"/", "");
count1 = date.Length;
extention = Path.GetExtension(fu_Resume.PostedFile.FileName);
reg_id = userid.Substring(
0, 1) + date.Substring(0, 2) + userid.Substring(1, count - 1) +
date.Substring(2, count1 - 2);
ResumeUrl = reg_id + extention;
fu_Resume.SaveAs(Server.MapPath(
"~\\JobSeeker\\resume\\") + ResumeUrl);
ocmd.Parameters.AddWithValue(
"@ResumeUrl", ResumeUrl);
}
else
{
ocmd.Parameters.AddWithValue(
"@ResumeUrl", "file not exits");
}
ocmd.Parameters.AddWithValue(
"@ExpYear", ddl_Years.SelectedItem.Value);
ocmd.Parameters.AddWithValue(
"@ExpMonth", ddl_Months.SelectedItem.Value);
if (txt_otherCity.Visible == true)
{
ocmd.Parameters.AddWithValue(
"@Location", txt_otherCity.Text);
}
else
{
ocmd.Parameters.AddWithValue(
"@Location", ddl_Locations.SelectedItem.Text);
}
ocmd.Parameters.AddWithValue(
"@FunctionalArea", ddl_FunctionalArea.SelectedItem.Text);
ocmd.Parameters.AddWithValue(
"@DateOfSubmit", DateTime.Now.ToShortDateString());
ocmd.ExecuteNonQuery();
MessageBox.Show(
"Record Submit");
ocn.Close();
}
and the Error is
*System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult
hr) at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult) at
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior,
Object& executeResult) at
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
at text.btn_Submit_Click(Object sender, EventArgs e) in
e:\wolkegist\jobsonrequest\jobsonrequest\text.cs:line 142 at
System.Web.UI.WebControls.Button.OnClick(EventArgs e) at
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) at
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,
String eventArgument) at
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint)*
please help to correct the error
--
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net