Hi!,
How can i store my button text stored into my database using sql server 2005 ?
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Aug 29, 2011, 10:10 AM EDT
Poppa Wallace97 reputationPosted Aug 29, 2011, 8:08 AM EDT
Button btn = (Button) sender;
//your sql data = btn.Text.Replace(" ", "");
Poppa Wallace97 reputationPosted Aug 29, 2011, 8:23 AM EDT
SqlCommand cmd = new SqlCommand(strSQL,this.sqlConnection1);
Black Diamond191 reputationPosted Aug 29, 2011, 8:58 AM EDT
string strSQL = "INSERT INTO Test (Test)" + " VALUES ('" + tn.Text.Replace(" ", "") + "')";
SqlCommand cmd = new SqlCommand(strSQL,this.sqlConnection1);
What is this.sqlConnection1?, is that my sql connection?
I got an error in this.sqlConnection1.
Poppa Wallace97 reputationPosted Aug 29, 2011, 9:27 AM EDT
Black Diamond191 reputationPosted Aug 29, 2011, 9:39 AM EDT
Black Diamond191 reputationPosted Aug 29, 2011, 8:00 PM EDT
VulpesRank #55 · 29.2K reputationPosted Aug 30, 2011, 12:58 AM EDT
Unless you're worried about losing votes if there's a system failure, there's no need to update the database every time a vote is cast but you can do so if you wish.