Hi All,
how to save (") Double Quotes,,in Sql Server Database in asp.Net Database through asp.Net TextBox?
Thanx In Advance,
Regards,
Sathish Pababthi
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
Sathish Pabbathi99 reputationPosted May 31, 2013, 12:40 AM EDT
Pankaj PandeyRank #642 · 3.7K reputationPosted May 31, 2013, 12:40 AM EDT
try this
string str= TextBox1.Text.Replace('"', '\"');
and use str.
Sathish Pabbathi99 reputationPosted May 31, 2013, 12:42 AM EDT
Rekha SinghRank #1,571 · 1K reputationPosted May 31, 2013, 12:57 AM EDT
string str = "" + "" + "";
SqlConnection conn = new SqlConnection(str);
conn.Open();
string insertquery = "insert into table(dbfield1) values(@dbfield1)";
SqlCommand cmd = new SqlCommand(insertquery, conn);
string value = "";
if (db1 != null)
{
cmd.Parameters.AddWithValue("@dbfield1", db1);
}
else
{
cmd.Parameters.AddWithValue("@dbfield1", value);
}
cmd.ExecuteNonQuery();
Pankaj PandeyRank #642 · 3.7K reputationPosted May 31, 2013, 1:37 AM EDT
you do not need to replace it again
see here
and result is