Results 1 to 7 of 7

Thread: ADO newbie

  1. #1

    Thread Starter
    Lively Member Patrice Bourdages's Avatar
    Join Date
    Jun 2000
    Location
    Quebec, Canada
    Posts
    83

    Unhappy

    I'm stuck.

    I need to convert a Clipper (xBASE compiler) with .dbf files into a VB application connected to a SQL Server 7.0.

    I'm totaly lost with the ADO stuff... Is there a simple explanation or notes somewhere that I could read in order to better understand what is going on...

    Here's the code I need to convert (example):

    function open_table()
    use temp new exclusive alias Temp
    use tablsigm new exclusive alias Sigma
    index on TableName to TablSigm
    use layas400 new exclusive alias LayoutAS400
    zap
    use dictionr new exclusive alias Dictionnary
    index on FieldName to dictionr
    return(.t.)

    How do I "open" all those SQL table (they are transfered on the SQL server as of now) from within VB using the ADO syntax...

    I'll have some more question... I'll keep them for later...

    Sincerely yours,

    Patrice :-)


  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    Can you explain what each line in the function does? Or better yet, post what you want the function to do...

    Some things will have no equivalent in SQL 7.0.

  3. #3

    Thread Starter
    Lively Member Patrice Bourdages's Avatar
    Join Date
    Jun 2000
    Location
    Quebec, Canada
    Posts
    83

    Smile ADO Newbie

    I need to open several tables at once and do some .Find and some update/create records in the table Dictionnary.

    The fact of opening those tables simultanously is to loop, find and grab whatever information possible to update the table Dictionnary.

    Can we have numerous connection opened at the same time (hope so). Otherwise, I'll end up swetting a lot...

    My IS manager sent me on VB courses so that I could upgrade my CA-Clipper apps into VB.

    Am i clear enough ??? Do you understand the purpuse of what I'm trying to do ?

    Thanks for your help.

    Sincerely, Patrice

  4. #4
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    How I would approach this

    The way that I would approach this would be to use the Connection to connect to the database and multiple recordsets to get to the tables.

    Code:
    GLOBAL DB as New Connection
    Sub Connect()
    
      DB.Open "dsn=YourDSN;uid=user;pwd=pass"  'ONLY DO THIS ONCE
    
    End Sub
    
    Sub OpenTables()
      Dim rs1 as New Recordset
      Dim rs2 as New Recordset
    
      rs1.open "SELECT * FROM tbl1",DB,adOpenForwardOnly,adOpenReadOnly
      rs2.open "SELECT * FROM tbl2",DB,adOpenForwardOnly,adOpenReadOnly
    
      if rs1.eof = false
        if rs2.eof = false
          'DO your work here
        end if
      end if
    
    End Sub
    Hope this helps

  5. #5

    Thread Starter
    Lively Member Patrice Bourdages's Avatar
    Join Date
    Jun 2000
    Location
    Quebec, Canada
    Posts
    83

    Talking

    Sounds great...

    Now, let's say I have an DataEnvironnement and a connection defined using ADO instead of a DSN, would it be the kind of syntax ?

    Here's the DataEnvironment data and connection:

    cnDictionnary:

    Provider=SQLOLEDB.1;
    Integrated Security=SSPI;
    Persist Security Info=False;
    Initial Catalog=Act1;
    Data Source=SQLSRV

    Would I simply go:

    cnDictionnary.Open instead of the connect string you provided me with ?

  6. #6
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    Yeah, I think that should work.

  7. #7

    Thread Starter
    Lively Member Patrice Bourdages's Avatar
    Join Date
    Jun 2000
    Location
    Quebec, Canada
    Posts
    83

    Talking

    Thanks a bunch Negative0.

    Appreciate it a lot.

    Sincerely,

    Patirce :-)

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