Print Page | Close Window

SqlWhereClause Change at runtime

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1625
Printed Date: 16-Apr-2025 at 10:28pm


Topic: SqlWhereClause Change at runtime
Posted By: vinothvdp
Subject: SqlWhereClause Change at runtime
Date Posted: 23-Jan-2010 at 4:29am
Greets,

i want to change the SqlWhereClause at run time. is this possible please help me out.

Thank you



Replies:
Posted By: davidklitzke
Date Posted: 25-Jan-2010 at 9:36am
For DevForce Silverlight, you would not use a SqlWhere clause in a command that you would send to the database.  You would use Linq and send the query to a DevForce EntityManager.


Posted By: vinothvdp
Date Posted: 28-Jan-2010 at 3:48am
i am using DevForce Classic, can i do here.if can then please give me some sample.


Posted By: smi-mark
Date Posted: 28-Jan-2010 at 8:36am
This question belongs in the " default.asp?C=5 - DevForce Classic Edition Topics " forum, not the Silverlight forum.

But to answer your question, yes, you can.

In your business object you can add this:

VB:

    Private _newWhereClause As String = "WHERE CLAUSE HERE"

    Public Overrides ReadOnly Property SqlWhereClause() As String
        Get
            Return _newWhereClause
        End Get
    End Property

C#:

private string newWhereClause = "WHERE CLAUSE HERE";

public override string SqlWhereClause()
{
         get
         {
              return newWhereClause; 
         }
}


Posted By: davidklitzke
Date Posted: 28-Jan-2010 at 9:55am
The simplest way to do this is with a PassthruRdbQuery.  There is an Intermediate Tutorial named "Pass-Through Queries".
 
There is a more complicated way to do this which requires writing some code which executes server-side.  There is an Advanced Tutorial named "Remote Service Methods".



Print Page | Close Window