TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
reetesh kiran
NA
5
730
getting error when inserting data into data base
May 3 2018 2:10 AM
when click on submit button getting error as
"
Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query."
my c# code :-
protected
void
Button1_Click(
object
sender, EventArgs e)
{
if
(RadioButton1.Checked)
{
Gender =
"Male"
;
}
else
if
(RadioButton2.Checked)
{
Gender =
"Female"
;
}
else
if
(RadioButton3.Checked)
{
Gender =
"Other"
;
}
if
(RadioButton4.Checked)
{
Relationship =
"Father"
;
}
else
if
(RadioButton5.Checked)
{
Relationship =
"Mother"
;
}
a = Class1.GetRandomPassword(5).ToString();
FileUpload1.SaveAs(Request.PhysicalApplicationPath +
"./images/registration/"
+ a + FileUpload1.FileName.ToString());
a1 =
"images/registration"
+ a + FileUpload1.FileName.ToString();
b = Class1.GetRandomPassword(5).ToString();
FileUpload2.SaveAs(Request.PhysicalApplicationPath +
"./images/registration/"
+ b + FileUpload2.FileName.ToString());
b2 =
"images/registration"
+ b + FileUpload2.FileName.ToString();
c = Class1.GetRandomPassword(5).ToString();
FileUpload3.SaveAs(Request.PhysicalApplicationPath +
"./images/registration/"
+ c + FileUpload3.FileName.ToString());
c3 =
"images/registration"
+ c + FileUpload3.FileName.ToString();
d = Class1.GetRandomPassword(5).ToString();
FileUpload4.SaveAs(Request.PhysicalApplicationPath +
"./images/registration/"
+ d + FileUpload4.FileName.ToString());
d4 =
"images/registration"
+ d + FileUpload4.FileName.ToString();
g = Class1.GetRandomPassword(5).ToString();
FileUpload5.SaveAs(Request.PhysicalApplicationPath +
"./images/registration/"
+ g + FileUpload5.FileName.ToString());
g5 =
"images/registration"
+ g + FileUpload5.FileName.ToString();
f = Class1.GetRandomPassword(5).ToString();
FileUpload6.SaveAs(Request.PhysicalApplicationPath +
"./images/registration/"
+ f + FileUpload6.FileName.ToString());
f6 =
"images/registration"
+ f + FileUpload6.FileName.ToString();
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText =
"insert into registration values('"
+ TextBox1.Text +
"','"
+ TextBox2.Text +
"','"
+ Gender +
"','"
+ dob.Text +
"','"
+ TextBox3.Text +
"','"
+ TextBox4.Text +
"','"
+ TextBox5.Text +
"','"
+ TextBox6.Text +
"','"
+ TextBox7.Text +
"','"
+ TextBox8.Text +
"','"
+ TextBox9.Text +
"','"
+ TextBox10.Text +
"','"
+ TextBox11.Text +
"','"
+ TextBox12.Text +
"','"
+ TextBox13.Text +
"','"
+ TextBox14.Text +
"','"
+ TextBox15.Text +
"','"
+ TextBox16.Text +
"','"
+ TextBox17.Text +
"','"
+ TextBox18.Text +
"','"
+ TextBox19.Text +
"','"
+ TextBox20.Text +
"','"
+ TextBox21.Text +
"','"
+ TextBox22.Text +
"','"
+ Relationship +
"','"
+ TextBox23.Text +
"','"
+ TextBox24.Text +
"','"
+ TextBox25.Text +
"','"
+ TextBox26.Text +
"','"
+ a1.ToString() +
"','"
+ b2.ToString() +
"','"
+ c3.ToString() +
"','"
+ d4.ToString() +
"','"
+ g5.ToString() +
"','"
+ f6.ToString() +
"')"
;
cmd.ExecuteNonQuery();
con.Close();
}
Reply
Answers (
5
)
In How many ways we can call multiple methods usingdelegate
I need to Create Leave approval system in C# and sql.