Question : Need Help.. couldn't find my problem

Dear Experts,

I am facing a problem. I wrong a store procedure when i pass the value manually its working fine but when i pass the value thru the string @criteria. its not retrieving the values from the database Could you please help me to figure out where i am doing the mistake. I am inclosing the store procedure and the code as well.. Your prompt action is highly appreicated.

for more informaiton my sCriteria contains at run time the following values

here is the procedure call. where sCriteria is

"'%naz%'"

or it will be like

"'%office%' OR KeyWord_En Like '%naz%'"

where KeyWord_En is the filed name

My StoreProcedure is like this

spGetSearchEn
@Criteria nvarchar(2000)
AS
BEGIN
SET NOCOUNT ON;
SELECT ID, Name_En, Description_En  from tbldata
Where KeyWord_En Like @Criteria
END

Regards
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
public static DataSet GetSearchResultEn(string sCriteria)
        {
            string qry;
            qry = "SELECT ID, Name_En, Description_En  from tblAlbahaData Where KeyWord_En Like" + sCriteria;
            SqlParameter[] inputArray = new SqlParameter[1];
            inputArray[0] = new SqlParameter("@Criteria", SqlDbType.NVarChar,2000);
            inputArray[0].Value = sCriteria;

            try
            {
                return SqlHelper.ExecuteDataset(Utility.ConnectionString(), CommandType.StoredProcedure, "spGetSearchEn", inputArray);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

Answer : Need Help.. couldn't find my problem

This option is part of the normal editor
Random Solutions  
 
programming4us programming4us