Are you using any stored procedures anywhere in your code? Somewhere in your source code the system is trying to convert the email address to an integer. That could happen in a stored proc.
Ok, that tells me you aren't using stored procedures. Can you do me a favor and re-post your front side html and code behind but this time, please use hte code posting tool above? Looks like { } next to HTML button.
All feild are inserted in table execpet password and confirm password..these two feilds displayed blank.do u geeting why this is blanked?whole code i already posted help me for this now.
Ok, what you want to do is don't put txtPassword and txtConfirmPassword. when you pass that value to the DB, only pass along txtPassword to your password field. The confirm is only supposed to check to be sure the user entered the password the same way twice.
Ya done with this but still password feild getting blank..well every time new error getting and geetting knowdlege.thnx for helping.hope u continue to help.pls tell me why getting it blank.is this data type prob?i set data type nvarchar.
Its possible that your page may be doing a postback which could clear the password field. Take a look at this related thread as they have some ideas on how to not loose the password.
apurva16
Member
21 Points
87 Posts
Re: Data type for email and phone no.
Apr 03, 2012 12:15 PM|LINK
No i am not converting,whole code i posted tell me where i made mistake and i set the datatype for email varchar now tell me what i made mistake.
bbcompent1
All-Star
32974 Points
8500 Posts
Moderator
Re: Data type for email and phone no.
Apr 03, 2012 12:25 PM|LINK
Somewhere you have to be specifying a conversion from varchar to int. Your insert code when you click the button looks like this:
protected void btnCreate_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(strConnection); con.Open(); cmd = new SqlCommand("Insert Into Newuser VALUES('" +txtFullname.Text+ "','" +txtUserName.Text+ "','"+txtPassword.Text+"','"+txtConfirmpassword.Text+"','"+txtEmail.Text+"','"+txtPhoneno.Text+"','"+DdlRegion.SelectedValue+"','"+DdlState.SelectedValue+"','"+DdlCity.SelectedValue+"','"+txtSecurityquestion.Text+"','"+txtSecurityanswer.Text+"')", con); cmd.ExecuteNonQuery(); }Did you change any of your code in particular this part of the code? Is your field in the database for email set to varchar or int?
apurva16
Member
21 Points
87 Posts
Re: Data type for email and phone no.
Apr 03, 2012 12:28 PM|LINK
i set the database feild for email is varchar.so what can i made changes to insert code pls tell me.
bbcompent1
All-Star
32974 Points
8500 Posts
Moderator
Re: Data type for email and phone no.
Apr 03, 2012 01:22 PM|LINK
Are you using any stored procedures anywhere in your code? Somewhere in your source code the system is trying to convert the email address to an integer. That could happen in a stored proc.
apurva16
Member
21 Points
87 Posts
Re: Data type for email and phone no.
Apr 03, 2012 03:40 PM|LINK
Not getting pls tell me what i do..
bbcompent1
All-Star
32974 Points
8500 Posts
Moderator
Re: Data type for email and phone no.
Apr 03, 2012 03:46 PM|LINK
Ok, that tells me you aren't using stored procedures. Can you do me a favor and re-post your front side html and code behind but this time, please use hte code posting tool above? Looks like { } next to HTML button.
apurva16
Member
21 Points
87 Posts
Re: Data type for email and phone no.
Apr 03, 2012 03:57 PM|LINK
hello,
i solved my problem changes the insert code showing below..
protected void btnCreate_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(strConnection);
con.Open();
cmd = new SqlCommand("Insert Into UserCreation(FullName,UserName,Email,PhoneNo,RegionID,StateId,CityID,Password,ConfirmPassword,SecurityQue,SecurityAns) VALUES(@FullName,@UserName,@Email,@PhoneNo,@RegionID,@StateId,@CityID,@Password,@ConfirmPassword,@SecurityQue,@SecurityAns)", con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@FullName",txtFullname.Text);
cmd.Parameters.AddWithValue("@UserName", txtUserName.Text);
cmd.Parameters.AddWithValue("@Email", txtEmail.Text);
cmd.Parameters.AddWithValue("@PhoneNo", txtPhoneno.Text);
cmd.Parameters.AddWithValue("@RegionID",DdlRegion.SelectedValue);
cmd.Parameters.AddWithValue("@StateId", DdlState.SelectedValue);
cmd.Parameters.AddWithValue("@CityID", DdlCity.SelectedValue);
cmd.Parameters.AddWithValue("@Password", txtPassword.Text);
cmd.Parameters.AddWithValue("@ConfirmPassword", txtConfirmpassword.Text);
cmd.Parameters.AddWithValue("@SecurityQue", txtSecurityquestion.Text);
cmd.Parameters.AddWithValue("@SecurityAns", txtSecurityanswer.Text);
cmd.ExecuteNonQuery();
con.Close();
}
All feild are inserted in table execpet password and confirm password..these two feilds displayed blank.do u geeting why this is blanked?whole code i already posted help me for this now.
Thanx.
bbcompent1
All-Star
32974 Points
8500 Posts
Moderator
Re: Data type for email and phone no.
Apr 03, 2012 04:00 PM|LINK
Ok, what you want to do is don't put txtPassword and txtConfirmPassword. when you pass that value to the DB, only pass along txtPassword to your password field. The confirm is only supposed to check to be sure the user entered the password the same way twice.
apurva16
Member
21 Points
87 Posts
Re: Data type for email and phone no.
Apr 03, 2012 04:11 PM|LINK
Ya done with this but still password feild getting blank..well every time new error getting and geetting knowdlege.thnx for helping.hope u continue to help.pls tell me why getting it blank.is this data type prob?i set data type nvarchar.
thanx.
bbcompent1
All-Star
32974 Points
8500 Posts
Moderator
Re: Data type for email and phone no.
Apr 03, 2012 04:14 PM|LINK
Its possible that your page may be doing a postback which could clear the password field. Take a look at this related thread as they have some ideas on how to not loose the password.
http://www.velocityreviews.com/forums/t114144-password-field-is-cleared-after-postback.html