Rajeesh MenothRank #118 · 18.4K reputationPosted Dec 24, 2015, 5:09 AM EST
0
Hi,
In your query only one gender column so why u use 2 radiobutton ? If you want to select male and female details in single radiobutton then use radiobuttonlist..inside the radiobutton add two list and add same group name
0
Rajeesh MenothRank #118 · 18.4K reputationPosted Dec 24, 2015, 5:21 AM EST
Ashok Kumar45 reputationPosted Dec 24, 2015, 5:37 AM EST
0
I got an Error while inserting values to DB
string or binary data would be truncated.
Statement has been terminated
My datatypes are:
DOB -datetime
MAIL- varchar(20)
GENDER- char(1),( radiobtn as Male &Female)
Status - bit with (combobox 0,1)
Is there any corrections regarding dis?..pls Help me
0
Rajeesh MenothRank #118 · 18.4K reputationPosted Dec 24, 2015, 5:47 AM EST
0
Hi, Put a varchar or int for radio button value.If you are saving male or female selected value then use in like 1 is male 0 mean female,otherwise directly add the text.
0
Raja TRank #685 · 3.5K reputationPosted Dec 24, 2015, 6:49 AM EST
0
Hello Ashok, alter the column data type
DOB -datetime MAIL- varchar(20) GENDER- char(1),( radiobtn as Male &Female) Status - bit with (combobox 0,1)
Changed To
DOB -datetime MAIL- varchar(20) GENDER- varchar(10),( radiobtn as Male &Female) Status - bit with (combobox 0,1)
And also please check combo box value 0,1 if not 0,1 change again status data type bit to char(10).
Rajeesh MenothRank #118 · 18.4K reputationPosted Dec 24, 2015, 3:59 AM EST
put a same groupname in radio button.then you can select one radiobutton at a time.
Ashok Kumar45 reputationPosted Dec 24, 2015, 4:01 AM EST
sorry can u explain clearly.
SqlDataAdapter SDA = new SqlDataAdapter("INSERT INTO Employee ( EmpId ,Name, DOB Country, Gender) VALUES ('" + textBox1.Text + "','" + textBox2.Text + "','" + dateTimePicker1.Text +'" + comboBox2.Text + "','" + radioButton1.Text + "','" + radioButton2.Text + "')", con);
Raja TRank #685 · 3.5K reputationPosted Dec 24, 2015, 4:22 AM EST
Ashok Kumar45 reputationPosted Dec 24, 2015, 5:02 AM EST
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
}
plz help..!Rajeesh MenothRank #118 · 18.4K reputationPosted Dec 24, 2015, 5:09 AM EST
In your query only one gender column so why u use 2 radiobutton ? If you want to select male and female details in single radiobutton then use radiobuttonlist..inside the radiobutton add two list and add same group name
Rajeesh MenothRank #118 · 18.4K reputationPosted Dec 24, 2015, 5:21 AM EST
Check the below reference.
http://guidecoders.blogspot.in/2012/01/radio-button-example-male-and-female.html?m=1
Ashok Kumar45 reputationPosted Dec 24, 2015, 5:37 AM EST
I got an Error while inserting values to DB
Rajeesh MenothRank #118 · 18.4K reputationPosted Dec 24, 2015, 5:47 AM EST
Put a varchar or int for radio button value.If you are saving male or female selected value then use in like 1 is male 0 mean female,otherwise directly add the text.
Raja TRank #685 · 3.5K reputationPosted Dec 24, 2015, 6:49 AM EST
DOB -datetime
MAIL- varchar(20)
GENDER- char(1),( radiobtn as Male &Female)
Status - bit with (combobox 0,1)
Changed To
DOB -datetime
MAIL- varchar(20)
GENDER- varchar(10),( radiobtn as Male &Female)
Status - bit with (combobox 0,1)
And also please check combo box value 0,1 if not 0,1 change again status data type bit to char(10).
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts