Results 1 to 4 of 4

Thread: Guru question - at least I think so: Generate SELECT from dataset

Hybrid View

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Asheville, nc
    Posts
    53

    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
    Victor

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Read in MSDN on OleDbCommandBuilder class and see if it's what you're looking for .


  3. #3
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690

    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.

  4. #4

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Asheville, nc
    Posts
    53

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



Click Here to Expand Forum to Full Width