TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Bineesh Viswanath
NA
1k
775.3k
How to search db value with 'or' condition sql server
Sep 16 2017 4:53 AM
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
Reply
Answers (
7
)
Class are not read in webservice Please Help me guys
Printing unicode to console in C#