467,081 Members | 1,254 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,081 developers. It's quick & easy.

C# APP Generate Dynamic SQL Statement from ListBox

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.fieldname". 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
  • viewed: 3593
Share:
3 Replies
Hi,

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
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.

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

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

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

solution
- 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

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



Thank you
Dec 5 '08 #3
Curtis Rutland
Expert 2GB
Please don't answer this last question in this thread. It has it's own:
http://bytes.com/answers/net/857501-...ay#post3440760
Dec 5 '08 #4

Post your reply

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

Similar topics

1 post views Thread by ōyvind Isaksen | last post: by
1 post views Thread by JMann101 | last post: by
1 post views Thread by Brian Henry | last post: by
8 posts views Thread by George Meng | last post: by
4 posts views Thread by ^MisterJingo^ | last post: by
4 posts views Thread by Kevin Blount | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.