Execute raw SQL in LLBL

Posts   
 
    
Sweety
User
Posts: 12
Joined: 21-Aug-2007
# Posted on: 12-Feb-2008 09:40:34   

Hi,

I want to execute a raw SQL statment through LLBL. (adapter)

For eg:

SELECT EmpId FROM Empolyees;

Can you please tell me how to do it.I checked some of the threads here regarding this topic but could not find the answer.

Please help. Thanks.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 12-Feb-2008 11:58:46   

Have you considered using DynamicLists or your case is more complex than what you have posted?

Sweety
User
Posts: 12
Joined: 21-Aug-2007
# Posted on: 12-Feb-2008 12:24:33   

Hello Walaa,

My case is I have to get the SQL statements from a TextBox (multiline) which is entred by user.My work requires that I save these SQL statements in a table in the DB.Before saving these statements I have to make sure that these SQL statement gets executed successfully in the DB without any error.The user will enter only the SELECT statements of any table in the DB.

So this is the scenario.I hope I'm clear to you.

can you please help me with some examples.

Thanks.

goose avatar
goose
User
Posts: 392
Joined: 06-Aug-2007
# Posted on: 12-Feb-2008 18:11:39   

In this case I think you'll be better passing directly the sql to the driver of your Database and later you could llbgen to persist the query to your DB.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 13-Feb-2008 11:36:36   

You could create a RetrievalQuery object and pass it to the FetchProjection / GetAsProjection routine to fetch it and then use one of the projection classes to project it to the object of choice, e.g. entities, datatable, custom class...

Frans Bouma | Lead developer LLBLGen Pro
Sweety
User
Posts: 12
Joined: 21-Aug-2007
# Posted on: 13-Feb-2008 11:40:47   

Thanks for your replies.

But i kind of had to stop that work.I directly used ADO.net to get the desired results.

But still if there is any example, it would be really helpful.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 13-Feb-2008 15:12:07   

I think the following thread has everything you need to know about executing raw SQL: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=9173