我正在使用ajax自动完成扩展程序和两个可以将数据返回到列表项的表,我想加粗来自表1的所有数据,以便我可以很容易地获得最高数据来自用户的用户表和最后一个数据来自最后一个表
[WebMethod]
public string[] GetNames(string prefixText)
{
DataSet ds = new DataSet();
DataTable dt = new DataTable();
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["medisiusHealthConnectionString"].ConnectionString);
DataSet ds2 = new DataSet();
DataTable dt2 = new DataTable();
//try
//{
con.Open();
SqlCommand cmd = new SqlCommand("select distinct ltrim(split.a.value('.','varchar(100)'))as string from (select cast ('<M>' + replace(speciality, ',', '</M><M>') + '</M>' as xml) as string from health where type='Doctor' and speciality like @myParameter) as a cross apply String.nodes ('/M') as split(a); select distinct services from healthservices1 left join health on health.sno=healthservices1.datakey where type='Doctor' and speciality like @myParameter", con);
cmd.Parameters.AddWithValue("@myParameter", "%" + prefixText + "%");
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
dt = ds.Tables[0];
dt2 = ds.Tables[1];
//Then return List of string(txtItems) as result
List<string> txtItems = new List<string>();
String dbValues;
if (ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow row in dt.Rows)
{
//String From DataBase(dbValues)
dbValues = row["string"].ToString();
string bold = "<b>" + dbValues.Trim() + "</b>";
//this is not working that is returning values like this ex. <b>name1</b>
but i want to bold the values return buy this table
txtItems.Add(bold.Trim());
}
if (ds.Tables[1].Rows.Count > 0)
{
foreach (DataRow row in dt2.Rows)
{
//String From DataBase(dbValues)
dbValues = row["services"].ToString();
txtItems.Add(dbValues.Trim());
}
}
return txtItems.ToArray();
con.Close();
}
else
{
string s = "Not Found";
txtItems.Add(s);
return txtItems.ToArray();
}
}
如何以粗体标题返回表1的所有值,以便我可以区分这两个表数据
例如
nitesh (表1值)
kumar (表1值)
你好(表2值)
你如何(表2价值)