string s = "select thought from thought_of_month"; SqlDataAdapter ad = new SqlDataAdapter(s, c.getcon()); DataSet ds = new DataSet(); ad.Fill(ds); if (ds.Tables[0].Rows.Count != 0) { thought = ds.Tables[0].Rows[0][0].ToString(); //thought = "hello"; try { ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('" + convertQuotes(ds.Tables[0].Rows[0][0].ToString()) + "');window.location ='User_Home.aspx';", true); } catch (Exception e1) { e1.Message.ToString(); } ----------- public string convertQuotes(string str) { return str.Replace("'", "''"); }
public string convertQuotes(string str) { return str.Replace("'", "\'"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)