Re: Dynamically Building SQL Statment

From: RichGK (sss.ee_at_rrr.rr)
Date: 02/24/05


Date: Thu, 24 Feb 2005 10:37:29 GMT


----- Original Message -----
From: "Me, Myself, and I" <spam@slufact0ry.com>
Newsgroups: microsoft.public.dotnet.languages.csharp
Sent: Thursday, February 24, 2005 2:07 AM
Subject: Dynamically Building SQL Statment

> First off, i apologize if my terminology is off...
>
> I am currently in a project that is basically a front-end to a
> database. In coding this, I am taking into account that it has the
> *potential* to be front-ended on multiple databases as well as
> rendered in multiple browser types.
>
> That being said, is there a pre-constructed class out there that I
> can call from within my code to systematically "build" my SQL
> statement and have it take into account the possibility to front
> multiple databases? I am not looking to use stored procedures or
> anything like that...it will be a simple CRUD-style SQL statment.
>
> Simply put, I want to instantiate a query object and call methods
> like AddSelect(), AddFrom(), AddWhere, AddOrder() to build the
> statment that would be submitted to the database.
>
>
> Thank You
> Adam

Hi Adam,

How complex are your SQL strings likely to be?

While there is a lot to be said for a generic class that handles a lot of
different types of queries, you have to think about how this generic class
will cause other areas of your program to become more complex.

If you have a query that is often used but only ever changes in how it
searches in certain columns, (ie SELECT [name], [age] FROM [Employees] WHERE
[name] = mySearchTerm1 AND [city] = mySearchTerm2) , then it would be better
for future reference if you simply held the entire string in a class and
changed the parts that you needed to change no?

Sorry if I've missed your point!
Rich.



Relevant Pages

  • Re: Autopopulate
    ... Because you have already queried the database once to populate the ... So in each tab I have the subforms set up with the fields in a 1 row ... I orginally wrote an SQL statment but I keept getting "The record has ... The DLookup was easy to use and it didn't create the "The record has ...
    (microsoft.public.access.forms)
  • Re: WHERE 1=2 with performance nightmares
    ... it would be interesting to see what tdataset says to the database to ... "prepare" a sql statment. ... How could the tdataset possibly get ... you can get the metadata information you're asking for. ...
    (borland.public.delphi.non-technical)
  • RE: Creating a table in Basic
    ... data from production to archive. ... create a delete query that points to the archve database. ... dbsArchive.Execute (sql statment) ...
    (microsoft.public.access.formscoding)
  • RE: Creating a table in Basic
    ... Dim dbsArchive as Database ... dbsArchive.Execute (sql statment) ... To move the data from the table to the archive, create an append query. ... You will want to change that to UNC mapping because not all users ...
    (microsoft.public.access.formscoding)