473,785 Members | 2,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Nov 16 '05 #1
1 1748

----- Original Message -----
From: "Me, Myself, and I" <sp**@slufact0r y.com>
Newsgroups: microsoft.publi c.dotnet.langua ges.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.
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1141
by: goitz | last post by:
Im looking for a way to dynamically create a table and append a text box to it using a list of information from a database eg> display a results of a select statment then add a text box--> field1 field2 textbo datagrids only allow clicking a button to edit a field, too much clicking to edit multiple fields required Please help
2
1093
by: djc | last post by:
I have something like the following: --------------------------------------------------- Dim btnAddUpdateDetail As New LinkButton() btnAddUpdateDetail.Text = "Add/Update Issue Detail" btnAddUpdateDetail.CommandName = "AddUpdateDetail" AddHandler btnAddUpdateDetail.Command, AddressOf HandleActions ActionsPanel.Controls.Add(btnAddUpdateDetail) Dim BR1 As New Literal()
5
1299
by: Jason | last post by:
Hi all I am building a page dynamically on Page_Load. using Table web controls for this. the web page builds up and loads up and displays ok. but as soon as there is a post back of any sort, all my dynamic building is gone. the page reverts back to it's "original" design time state. i have a OK button, that when the user clicks on this button, it will go and get data from the dynamically built page. but obviously i cant do that,
0
1069
by: Craig G | last post by:
i want to build a datagrid to use as a register for a number of courses. what i want to happen is that the tutor selects the course from a combo box. this then builds a grid for all students enrolled on the course along with the number of weeks the course has to run i want the datagrid to build a column for each week of the course. and then list the students in rows. with a checkbox being in every itemtemplate so that the tutor can say...
2
11422
by: ahmad | last post by:
when i used the statment for(var i = 0; i < menu.length; i++) { menu.options.selected = "false"; } to deselect all the options within a list, it surprisingly selected all the options. I tried another option like menu.options.removeAttribute("selected");
7
10067
by: Steve_Black | last post by:
Hello, I'm toying with the idea of loading a MenuStrip (VB.Net 2005) dynamically based on who is logged into my system. Every user has different security settings and I want to customize the main menu instead of showing all possible options and only enabling/disabling certain ones. I have a table that stores the menu item name, parent item (if applicable), display order, etc. so that I can dynamically load my
1
1589
by: zeebiggie | last post by:
Good morning I have a form with the controls in the insert statment below. table1 has an Auto increment primary key hence is omitted in the insert statment and form. Am getting the error It didnt work " .mysql_insert_id(); and not any other php or mysql error to tell me if anything is wrong the insert statment. To top it up, I have an echo statment of the insert statment before it executes, when I copy and paste the insert statment from...
2
2088
by: grant | last post by:
Man do I struggle with Enterprise Manager as a graphical tool for building views etc. Its flaky and hangs frequenlty so i have to kill it with the task manager and re open it. You cant debug functions ( or am I missing something) But the worst thing is that it appears to cache the results of views and doesnt refresh from the source.
8
2819
by: BillE | last post by:
When I create a control dynamically and it grows according to the content, the control Height property still returns the original default control height instead of the height after expanding. How can I get the height of the control (in code) after it grows? I am building a windows form dynamically, creating controls and placing them on the form. There can be dozens of controls of all types on the form. This is for dynamic...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10087
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.