thid query How to use OR

Data Access Application Blocks Forum

thid query How to use OR

Postby tenvick on Mon May 26, 2008 4:08 am

I want to run sql like this \"select * form Stick where StickID=1 or ParentID=1\"

How Can I do this in EasyObject?

Stick obj = new Stick();
obj.Where.StickID.Value = StickID;
obj.Where.ParentID.Value = StickID;
obj.Query.Load();
implssible is nothing
tenvick
Lurker
 
Posts: 9
Joined: Fri Aug 17, 2007 3:41 am

Postby mgnoonan on Mon May 26, 2008 5:55 pm

Easy enough!

Code: Select all
Stick obj = new Stick();
obj.Where.StickID.Value = StickID;
obj.Where.ParentID.Value = StickID;
obj.Query.Load(\"OR\");
Matt Noonan
EasyObjects.NET - The O/RM for the Enterprise Library
http://www.easyobjects.net
User avatar
mgnoonan
Expert
 
Posts: 1019
Joined: Tue Sep 14, 2004 3:17 am
Location: Springboro, OH

Postby tenvick on Tue Jun 10, 2008 9:52 am

thanks mgnoonan .
but I got a real problem.
I want to run sql \"select * from news where keyword like '&key1&' or keyword like '%key2%' or keyword like '%key3%' ... \"

how can I do ?

I write like this

CateNewsView obj = new CateNewsView();
foreach (string key in keywords)
{
if (key != string.Empty)
{
obj.Where.KeyWords.Value = \"%\" + key + \"%\";
obj.Where.KeyWords.Operator = NCI.EasyObjects.WhereParameter.Operand.Like;
obj.Where.KeyWords.Conjunction = NCI.EasyObjects.WhereParameter.Conj.Or;

}
}

obj.Query.Load();
return obj.DefaultView;
but it doesnt right .it only one KeyWords
implssible is nothing
tenvick
Lurker
 
Posts: 9
Joined: Fri Aug 17, 2007 3:41 am

Postby dnparsons on Sat Jun 21, 2008 12:48 pm

It's been a while since I've looked at EasyObjects (or DOOdads, for that matter), but if you need to use the same column more than once in a Where condition, I think you'll need to use a TearOff.

http://www.mygenerationsoftware.com/php ... .php?t=107
David Neal Parsons
EntitySpaces
User avatar
dnparsons
Lieutenant General
 
Posts: 292
Joined: Sun Jan 09, 2005 2:10 pm
Location: Miami, Florida

Postby tenvick on Mon Jun 23, 2008 3:51 am

can you give me a example?
implssible is nothing
tenvick
Lurker
 
Posts: 9
Joined: Fri Aug 17, 2007 3:41 am


Return to EasyObjects.NET (Microsoft Enterprise Library)

Who is online

Users browsing this forum: No registered users and 1 guest

cron