Sri Kanth

Sri Kanth

  • NA
  • 7
  • 2.6k

Build String Using Escape Sequences

Oct 7 2008 6:16 AM

Can any help building a valid string for

<a href="#" onmouseover="showToolTip(event,'This is a simple, simple test');return false" onmouseout="hideToolTip()">Roll over me</a>

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 = @"<a href=\" # \" onmouseover=\""showToolTip(event,'" + dsTool.Tables[0].Rows[0]["testtext"].ToString() + "');return false\">"+o.ToString()+"</a>";

strReturn +="onmouseout=\""hideToolTip()\"">"+o.ToString()+"</a>";

}

return strReturn;

 


Answers (1)