Hi all
How get session value in select statement in web method
I want to include the session value in the select sentence
I have this code
[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod]
public static List<string> GetCompletionList(string prefixText, int count)
{
using (OracleConnection con = new OracleConnection("data source=localhost:1521/orcl; user id=alhakimy; password=alhakimyyes;"))
{
using (OracleCommand com = new OracleCommand())
{
com.CommandText = "select doc_no, doc_name from doctors where city_no= Session['city_no'] and doc_name like '%" + prefixText + "%' ";
com.Parameters.Add("@TextBox1", prefixText);
com.Connection = con;
con.Open();
List<string> summ = new List<string>();
using (OracleDataReader sdr = com.ExecuteReader())
{
while (sdr.Read())
{
summ.Add(string.Format("{0}-{1}", sdr["DOC_NAME"], sdr["Doc_NO"]));
}
}
con.Close();
return summ;
}
}
}