Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 15, 2012 02:12 AM by Decker Dong - MSFT
Member
4 Points
6 Posts
Mar 13, 2012 05:56 AM|LINK
once I entered the data, the error shows below here, but actually I am able to log in with the username that I have just registered, it just didnot response me to other pages
datasource.InsertParameters.Add("UserId", UserId.ToString) datasource.Insert()
Could someboyd please help me with this problem?
39 Points
37 Posts
Mar 13, 2012 05:59 AM|LINK
try { con.Open(); SqlCommand cmd = new SqlCommand("insert into customer values('"+TextBox1.Text+"','"+TextBox2.Text+"','"+TextBox4.Text+"','"+Session["cn"].ToString()+"','"+Session["st"].ToString()+"','"+Session["cy"].ToString()+"','"+TextBox5.Text+"',"+TextBox6.Text+",'"+TextBox7.Text+"','"+DropDownList4.SelectedValue+"','"+TextBox8.Text+"','"+st+"')", con); cmd.ExecuteNonQuery(); Session["uid"] = TextBox2.Text; Response.Redirect("login.aspx"); con.Close(); } catch (Exception e1) { Label15.Text = e1.Message; } } else { Label16.Text="Re enter the text....";
}
USE THIS CODE
All-Star
118619 Points
18779 Posts
Mar 15, 2012 02:12 AM|LINK
Rudy91 datasource.InsertParameters.Add("UserId", UserId.ToString)
You've missed a "@" ,and it should be:
datasource.InsertParameters.Add("@UserId", UserId.ToString)
Rudy91
Member
4 Points
6 Posts
I have some problem in creating a registration form,
Mar 13, 2012 05:56 AM|LINK
once I entered the data, the error shows below here, but actually I am able to log in with the username that I have just registered, it just didnot response me to other pages
datasource.InsertParameters.Add("UserId", UserId.ToString)
datasource.Insert()
Could someboyd please help me with this problem?
shubh_786
Member
39 Points
37 Posts
Re: I have some problem in creating a registration form,
Mar 13, 2012 05:59 AM|LINK
try
{
con.Open();
SqlCommand cmd = new SqlCommand("insert into customer values('"+TextBox1.Text+"','"+TextBox2.Text+"','"+TextBox4.Text+"','"+Session["cn"].ToString()+"','"+Session["st"].ToString()+"','"+Session["cy"].ToString()+"','"+TextBox5.Text+"',"+TextBox6.Text+",'"+TextBox7.Text+"','"+DropDownList4.SelectedValue+"','"+TextBox8.Text+"','"+st+"')", con);
cmd.ExecuteNonQuery();
Session["uid"] = TextBox2.Text;
Response.Redirect("login.aspx");
con.Close();
}
catch (Exception e1)
{
Label15.Text = e1.Message;
}
}
else
{
Label16.Text="Re enter the text....";
}
USE THIS CODE
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: I have some problem in creating a registration form,
Mar 15, 2012 02:12 AM|LINK
You've missed a "@" ,and it should be:
datasource.InsertParameters.Add("@UserId", UserId.ToString)