|
-
Feb 18th, 2005, 03:15 PM
#1
Thread Starter
Member
Guru question - at least I think so: Generate SELECT from dataset
I am constructing a dataset in memory from one or multiple tables with some links between them. I use existing tables from my database and user can select any combination of them to create his own data source.
It is like when you create a view in SQL Server and it creates SQL SELECT statement for you.
My question is:
Can ADO.NET somehow help me to create/generate SQL SELECT statement based on constructed dataset?
Thank you.
Victor
-
Feb 18th, 2005, 08:21 PM
#2
Sleep mode
Read in MSDN on OleDbCommandBuilder class and see if it's what you're looking for .
-
Feb 19th, 2005, 12:14 PM
#3
Frenzied Member
Re: Guru question - at least I think so: Generate SELECT from dataset
Are you allowing them to specify individual columns as well, or just the tables? If it's only the tables, you could create a GetTable(string tableName) method that returns a DataSet consisting of one DataTable. Then you extract the DataTable and add to the DataSet you're building. Or pass in an array of strings for multiple tables.
If you're allowing them to choose individual columns, it wouldn't be too hard to generate the SELECT statement yourself. I'm not aware of any DataSet methods that return a sql string, never tried that.
-
Feb 21st, 2005, 08:52 AM
#4
Thread Starter
Member
Re: Guru question - at least I think so: Generate SELECT from dataset
Thank you guys. CommandBuilder doesn't generate SELECT statement. And it is easiest part to add columns to SELECT statement, most difficult part is to create FROM part with links.
Victor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|