Hi Sir,
I am in a project in which I need to implement search criteria using OR condition.
means, I need to search different column values based upon one sql parameter.
Kindly tell me the below query to replace 'AND' condition with 'OR'
isnull(cast(tblCustomer.strMobile as nvarchar (20)),'') LIKE '%'+@asMobile+'%'
and
isnull(cast(tblCustomer.strPhoneOff as nvarchar (20)),'') LIKE '%'+@asMobile+'%' and
isnull(cast(tblCustomer.strPhoneOff1 as nvarchar (20)),'') LIKE '%'+@asMobile+'%' and
isnull(cast(tblCustomer.strPhoneRes as nvarchar (20)),'') LIKE '%'+@asMobile+'%'
for c# code , I given like this:-
cmd.Parameters.Add("@asstrMobile", SqlDbType.NVarChar).Value = tbxOfficeResMobile.Text.Trim();
cmd.Parameters.Add("@asPhoneOff", SqlDbType.NVarChar).Value = tbxOfficeResMobile.Text.Trim();
cmd.Parameters.Add("@asPhoneOff1", SqlDbType.NVarChar).Value = tbxOfficeResMobile.Text.Trim();
cmd.Parameters.Add("@asPhoneRes", SqlDbType.NVarChar).Value = tbxOfficeResMobile.Text.Trim();
This code is not working because of all parameter taking same value. I think I need to change the SQL


Prakashraj PRank #1,032 · 1.9K reputationPosted Sep 16, 2017, 1:40 AM EDT
Amit GuptaRank #190 · 12.8K reputationPosted Sep 16, 2017, 1:54 AM EDT
Bineesh ViswanathRank #1,680 · 907 reputationPosted Sep 16, 2017, 2:45 AM EDT
Amit GuptaRank #190 · 12.8K reputationPosted Sep 16, 2017, 2:49 AM EDT
Bineesh ViswanathRank #1,680 · 907 reputationPosted Sep 18, 2017, 11:58 PM EDT
Amit GuptaRank #190 · 12.8K reputationPosted Sep 19, 2017, 12:09 AM EDT
Bineesh ViswanathRank #1,680 · 907 reputationPosted Sep 25, 2017, 4:08 AM EDT