How to check if a particular word is present in a column of sharepoint list

super9xman

New Member
I have a sharepoint 2007 list in which there is a column 'EmpID' which contains employee ids in this format: 12345;6789;121212I need to find if 12345 is present in EmpID column. If i use caml query using asp.net It does not give me any result for only "12345".If i enter whole data "12345;6789;121212" then only it gives me result. Please Help. I nees to search only 12345\[code\]using (SPSite site = new SPSite("URL")) { using (SPWeb web = site.OpenWeb()) { SPList List = web.Lists["List Name"]; SPQuery query = new SPQuery(); query.Query = "<Where><Eq><FieldRef Name='EMP_x0020_ID' /><Value Type='Text'>" + TextBox1.Text + "</Value></Eq></Where><OrderBy><FieldRef Name='Title'/></OrderBy>"; SPListItemCollection items = List.GetItems(query); DataTable dt = items.GetDataTable(); if (dt==null) { Label1.Text = "No data"; } else { foreach (DataRow r in dt.Rows) { Label1.Text += r["Title"]; } } }\[/code\]}
 
Back
Top