Results 1 to 6 of 6

Thread: Data Enviroment problem

  1. #1

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303

    Unhappy

    I've just started using the DE with SQL. Now I've managed to get the DE to display all my tables, views and SP no problem.

    How do I get the information out of a table/view. It doesn't matter what I try I just cannot get any data to display via code.

    Please please help
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

  2. #2
    Addicted Member
    Join Date
    May 2000
    Posts
    188
    To get the info from a table, view or stored procedure into a recordset to access through code create a command object in the dataenvironment (ie. right click on the connection) and in the general tab under database object choose the database object (table, view etc...) and under object name choose the object you want to use from the database. Then in code open the command object.

    Under the Advanced tab make sure that returns a recordset is checked.

    (DataEnvironment1.Command1) and you can then access the recordset opened (DataEnvironment1.rsCommand1).

  3. #3

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303

    Unhappy

    Sorry if I seem a little thick at the minute, but could you give me a little example of the code to open the table. I've checked the DE and the advanced tab and no problem, but when I try to open anything I get no luck
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

  4. #4
    Addicted Member
    Join Date
    May 2000
    Posts
    188
    Once your command is created and set up to return a recordset it should work like this in your code:

    DataEnvironment1.Command1

    then you can access the recordset like this

    DataEnvironment1.rsCommand1

    if this doesn't make sense or work try sending me some of your code and I can take a look at it...

  5. #5

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303
    That worked fine thanks.
    Another quetion how can I open the same table in the form of an SQL statement so that it only returns certain values

    i.e

    strSQL = "SELECT * FROM table WHERE ID ='" & strID & "'"
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

  6. #6
    Addicted Member
    Join Date
    May 2000
    Posts
    188
    If you want to do that here's my recommendation.

    Don't open a table...

    instead when you set up your command object in the data environment insert an sql statement like:
    SELECT * FROM table WHERE ID = ?
    into the SQL Statement box... the ? will set up a parameter that can be accessed from then on when you open the command us this method...

    DataEnvironment1.Command1 strID

    where strID is the value you want to pass to the sql string in the command... try it and let me know if it works... anymore questions feel free to ask!


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