Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
1.15/5 (3 votes)
See more:
Dear All,

I developed one page here requirement is

Name: textbox1.text
Address: textbox2.text
Mobile: textbox3.text
Joining Date:dropdownlist1 and dropdownlist2

once fill these like name: qqqq, address:ssss, Mobile:1234567890, joiningdate:10(month) 2001(year)

like above output i want how write the logic please reply me
Posted
Comments
Sergey Alexandrovich Kryukov 18-Jun-14 1:49am    
What the beast is that, "drop downlist boxes"?! There are "drop-down list boxes". You did not explain anything like a problem. So far, this post makes no sense at all. You can improve it using "Improve question".
—SA
member258 18-Jun-14 2:14am    
here once fill name, address, mobile and select dropdownlist(march)dropdownlist(2014)

output is:
name:qqqq
address:rrrr
mobile:1234567890
joining date:march 2014

this output i want

and my code is:
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString);
con.Open();
string str = "insert into PlaceTable values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + DropDownList1.Text + "','" + DropDownList2.Text + "')";
SqlCommand cmd = new SqlCommand(str, con);
cmd.ExecuteNonQuery();
con.Close();
Label1.Text = "data inserted sucessfully";
}

this is my code data base how i create like my columns is:name,address,mobile,joiningdate

these are database table columns

here proper code and table please reply me
KaushalJB 18-Jun-14 1:50am    
What logic ?? Your question is not clear about what you actually want..you want dropdownlist text or something else... Please be specific
member258 18-Jun-14 2:10am    
here once fill name, address, mobile and select dropdownlist(march)dropdownlist(2014)

output is:
name:qqqq
address:rrrr
mobile:1234567890
joining date:march 2014

this output i want

and my code is:
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString);
con.Open();
string str = "insert into PlaceTable values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + DropDownList1.Text + "','" + DropDownList2.Text + "')";
SqlCommand cmd = new SqlCommand(str, con);
cmd.ExecuteNonQuery();
con.Close();
Label1.Text = "data inserted sucessfully";
}

this is my code data base how i create like my columns is:name,address,mobile,joiningdate

these are database table columns

here proper code and table please reply me
Paulo Augusto Kunzel 18-Jun-14 8:24am    
Hi member258,
Please help me clarify:
1) Are name, address, mobile and joiningdate the columns on your database? If yes, are there other columns?
2) Do you have 1 or 2 DropDownLists on your page?
3) Is your problem related to get the value from the DropDownList or to Save it?

regards

1 solution

C#
Name: textbox1.Text
Address: textbox2.Text
Mobile: textbox3.Text
Joining Date: dropdownlist1.SelectedItem.Text + " " +  dropdownlist2.SelectedItem.Text 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900