Can any help building a valid string for
using Escape sequences. I have tried but i am getting error
this way i have tried.
DataSet
dsTool = new DataSet();string strToolTip = o.ToString();
string strCn = "Server=server;Database=pubs;User Id=uid;Password=pwd"; SqlConnection cn = new SqlConnection(strCn);cn.Open();
SqlCommand cm = new SqlCommand("select testname,testtext from testtabs where testid=" + strToolTip, cn); SqlDataAdapter dap = new SqlDataAdapter();dap.SelectCommand = cm;
dap.Fill(dsTool);
if (dsTool.Tables[0].Rows.Count > 0){
strReturn =
new StringBuilder("");strReturn =
@" # \" onmouseover=\""showToolTip(event,'" + dsTool.Tables[0].Rows[0]["testtext"].ToString() + "');return false\">"+o.ToString()+"";strReturn +=
"onmouseout=\""hideToolTip()\"">"+o.ToString()+"";}
return strReturn;
AlanPosted Oct 7, 2008, 6:38 AM
Try:
strReturn.Append("Roll over me");
I think where you're going wrong at the moment is that you're escaping the double quotes using '\' but specifying that the string is verbatim (using @) at the same time. In a verbatim string, double quotes should be escaped by doubling them ("").