mabelwhite
New Member
Here is the image of the model. You can see the column i am searching is type string.! http://imgur.com/kU1T7Now i just want to take input from a text box and match it with the desired column.\[code\]protected void Button1_Click(object sender, EventArgs e){ String val = Convert.ToString(TextBox1.Text.Trim()); Entities query = new Entities(); var txn = (from p in query.MAINs where p.PAN.Equals(val, StringComparison.OrdinalIgnoreCase) select p).ToList(); GridView1.DataSource = txn.ToList(); GridView1.DataBind();}\[/code\]but the query returns null(rowcount=0). i have checked the val variable. its sending the exact parameter. when i am giving the value direct then its returning result.\[code\]protected void Button1_Click(object sender, EventArgs e){ String val = Convert.ToString(TextBox1.Text.Trim()); Entities query = new Entities(); var txn = (from p in query.MAINs where p.PAN.Equals("1010170000000030", StringComparison.OrdinalIgnoreCase) select p).ToList(); GridView1.DataSource = txn.ToList(); GridView1.DataBind();}\[/code\]I am newbie to Linq and entity framework. This thing driving me nuts. Have no idea why taking input from a text box is not working. Any kind of help will be greatly appreciated as i am stuck in this for 3 days. Please help me out.