multiple textbox text save in one field
-
hi.. I need 2 know How i am Insert multiple textbox text in one field For Example I have one Field name data and i have 3 textbox i want to insert 3 textbox data in one field. hope u understand my problem i am waiting your response. Thanks In advance Jawad khatri
-
hi.. I need 2 know How i am Insert multiple textbox text in one field For Example I have one Field name data and i have 3 textbox i want to insert 3 textbox data in one field. hope u understand my problem i am waiting your response. Thanks In advance Jawad khatri
-
I don't get what the problem is? Where do you fail in your attempt to copy the data from your textboxes? You access the data in a textbox by using the
Text
property..yes i want to access data to text property let suppose i have 3 textboxes text1.text = I text2.text = am text3.text - jawad now i want to save these 3 textboxes data in one field
-
yes i want to access data to text property let suppose i have 3 textboxes text1.text = I text2.text = am text3.text - jawad now i want to save these 3 textboxes data in one field
-
Just concatenate your textbox content to a string:
string theString = string.Empty;
text1.Text = "I";
text2.Text = "am";
text3.Text = "jawad";
theString = text1.Text + text2.Text + text3.Text;Still not sure if this is what you're after though..:confused:
thanks for response. i have a table Data have one field name description. and i have 3 textboxes Rate,Weight,Product i want to save data of Rate,Weight,Product in description field Now hope u understand
-
thanks for response. i have a table Data have one field name description. and i have 3 textboxes Rate,Weight,Product i want to save data of Rate,Weight,Product in description field Now hope u understand
-
Is "Data" a table in a database? Could you post the code you're having trouble with and describe what goes wrong and what you want it to do?
Yes Data Is table in database SqlConnection conn = new SqlConnection(connString); string query = "insert into Data(Product,discription) values('" + txtproduct.Text + "','" + txtrate.Text + "'&& '" + txtweight.Text + "')"; SqlCommand cmd = new SqlCommand(query, conn); try { conn.Open(); cmd.ExecuteNonQuery(); MessageBox.Show("Record Inserted Sucessfully."); } finally { conn.Close(); }
-
Yes Data Is table in database SqlConnection conn = new SqlConnection(connString); string query = "insert into Data(Product,discription) values('" + txtproduct.Text + "','" + txtrate.Text + "'&& '" + txtweight.Text + "')"; SqlCommand cmd = new SqlCommand(query, conn); try { conn.Open(); cmd.ExecuteNonQuery(); MessageBox.Show("Record Inserted Sucessfully."); } finally { conn.Close(); }
Okay, and what is the error your receiving? Do you really want the concatenated string to look like this (if txtrate=theRating, txtweight=theWeight)?
theRating'&&'theWeight
Or do you want:theRating&&theWeight
Check the part where you put your strings together. If you want to use a'
in your concatenated string you have to use double''
like this:string query = "insert into Data(Product,discription) values('" + textBox1.Text + "','" + textBox2.Text + "''&& ''" + textBox3.Text + "')";
modified on Friday, March 12, 2010 7:01 AM
-
Okay, and what is the error your receiving? Do you really want the concatenated string to look like this (if txtrate=theRating, txtweight=theWeight)?
theRating'&&'theWeight
Or do you want:theRating&&theWeight
Check the part where you put your strings together. If you want to use a'
in your concatenated string you have to use double''
like this:string query = "insert into Data(Product,discription) values('" + textBox1.Text + "','" + textBox2.Text + "''&& ''" + textBox3.Text + "')";
modified on Friday, March 12, 2010 7:01 AM
I have Done :) Thanks For Help Me Sir
-
I have Done :) Thanks For Help Me Sir