473,837 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# APP Generate Dynamic SQL Statement from ListBox

6 New Member
hi, i am fresh grad and wondering whether this idea can be done..

i have 1 ComboBox and 2 ListBox. ComboBox contain list of table, when user select a table, it will list the field name for selected table in ListBox1. The ListBox2 will list the selected field name by user. It will display in list box with this format "tablename.fiel dname". So far i have done until this.

Now i am wondering whether can create SQL statement for each table in ListBox2 (the selected field by user).
- example: if it have 5 tables, it generate 5 sql statement. The field name is the field which was selected by user.
- In ListBox2, it can have more than 1 table and more than 1 field for each table.
- No join statement

Objective: I want to allow user dynamically create sql statement, by allow user to select table name and field name.

So is it possible for the above to be done? if yes any help or any idea how to achieve that........... .
Dec 3 '08 #1
3 3901
6 New Member

Somehow i manage to solve the previous post problem....
not sure whether it is long or what....
but it is working and able to generate the sql statement perfectly from the list box 2......

Thank You
Dec 4 '08 #2
6 New Member
Hi, can anyone help me on this problem. It is quiet urgent......

i have two CheckedListBox (CLBa and CLBb) , and i want the user selected CheckedListBox is assign to two dimension array.

There is a sql statement (select * from tblname where field1= ' ' OR field2=' '),
i want to allow user to choose the data for filetring,

- field1 will read selected item in CLBa
- field2 will read selected item in CLBb
- the sql statement is use for 1 table only

- single row might have selected data in field1 and field2
- row is not duplicated in the result of select statement

- i plan to assign the selected item in CLBa and CLBb to a two dimensional array
- from the array i read the data and filter

- how to assign the selected in both check box list to an two dimension array?

Thank you
Dec 5 '08 #3
Curtis Rutland
3,256 Recognized Expert Specialist
Please don't answer this last question in this thread. It has it's own:
Dec 5 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Øyvind Isaksen | last post by:
Hello! I need to dynamic generate a SQL statement based on how many images a user select to upload. Here you see an example with 2 images. It can be up to 50 images and I dont want to write this lines 50 times since they are almost identical (Example, first line has "varImage_1" , the second has "varImage_2"... and It shall go up to varImage_50...).
by: starace | last post by:
I have designed a form that has 5 different list boxes where the selections within each are used as criteria in building a dynamic query. Some boxes are set for multiple selections but these list boxes do not necessarily need to have a selection made to be used in the dynamic query. In essence the form can have selections made in all or none of its list boxes to form the dynamic query I am looking to get some feedback in reference to...
by: JMann101 | last post by:
I am writing a ASP.NET(VB) application and am having some trouble. I have a datagrid which list users and when an admin clicks "edit" a defined column becomes visible and a dynamic listbox control is added to that column/row. When the admin clicks "update" I am unable to retrieve the values that were selected from that listbox. Basically, This is a multi-select listbox, so I need to loop to pull all selected items. This is the only...
by: Brian Henry | last post by:
I am working on an data bound list that implements of course IList, IBindingList, IComparer, etc... your basic things your need for data binding type objects... the problem is i got it to work staticly... that is fill it with data then bind it and the data shows up in a listbox like it should... but if i was to add another object to the custom data bound list i made it doesnt show up in the listbox... how do you get this update to run...
by: George Meng | last post by:
I got a tough question: The backgroud for this question is: I want to design an application works like a engine. After release, we can still customize a form by adding a button, and source code for the button. (This is done by the form itself, not by using VS.Net) (button and source code should be a record in database, these information should be retrieve from database when the form shows up) What I want is:
by: ^MisterJingo^ | last post by:
Hi all, I have a web page which has a single dropdownlist containing 3 items. Below the dropdownlist are two listboxes. Depending on the option selected from the dropdownlist, the left most listbox populates itself from a DB table, assigning the correct id to each item as a value. In between the listboxes are two buttons. On clicking an 'add' button, I am trying to grab the id of the item selected (the goal being to place this id and...
by: Dazbear | last post by:
Hi There Have been on a massive learning curve today creating an Access database without having even started the software before this morning! All going well and have learned to create table, forms, queries and even inter link. The database records support for a cohort of schools, giving the ability to give summaries of support by consultant, subject etc. So far all is going well with data being inputted by way of a school support
by: Kevin Blount | last post by:
As mentioned before, I'm creating a multi-lingual page where the text of the page comes from a database. This page includes a registration form which asks for address information, including the Country. I have 6 .txt files that contain a complete list of countries that we sell to (65 in total), each written in the appropriate way for the language of the site, e.g. Mexico for English US and UK sites and México for the Spanish language...
by: skyson2ye | last post by:
Hi, guys: I have written a piece of code which utilizes Javascript in PHP to create a three level dynamic list box(Country, States/Province, Market). However, I have encountered a strange problem, and I have spent three days trying to debug but to no avail. Everything is OK when there are only two dependent list boxes, but when adding the third child list box, a problem appears: if I populate the third box only with the value: new...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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...
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
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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.