Results 1 to 3 of 3

Thread: Data environment problem

  1. #1
    makla
    Guest

    Data environment problem

    I am trying to use the DataEnvironment in VB to connect to a database.
    This database could be a either a MS Access or SQL server database (depends on DBMS is ini-file.

    I use the following connectionstring:
    'open database (MS ACCESS)
    If DBMS = "MS ACCESS" Then
    DB_PASSWORD = "test"
    If RSDDatabase.RSDDatabase.State <> 1 Then
    connectie = "Data Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & DATABASE & ";Persist Security Info=False;Jet OLEDBatabase Password=" & DB_PASSWORD
    RSDDatabase.RSDDatabase.ConnectionString = connectie
    RSDDatabase.RSDDatabase.Open
    End If
    End If

    'open database (SQL SERVER)
    If DBMS = "SQL SERVER" Then
    If RSDDatabase.RSDDatabase.State <> 1 Then
    connectie = "Provider=SQLOLEDB;Server=" & SERVER & ";Database=" & DATABASE & ";Integrated Security=SSPI;Persist Security Info=False;"
    RSDDatabase.RSDDatabase.ConnectionString = connectie
    RSDDatabase.RSDDatabase.Open
    End If
    End If

    I got the error: Run time error '-2147217887 (80040e21)':
    Unable to set data provider properties.

    This error happens when I set DBMS to 'SQL SERVER' and the Dataenvironment OLE DB (first tab) is set to Microsoft Jet 4.0 OLE DB Provider at design time.

    The same error occurs when I set DBMS to 'MS ACCESS' and the Dataenvironment OLE DB (first tab) to Microsoft Jet 4.0 OLE DB Provider for SQL server at design time.

    I want to choose in the ini file which database (MS Access or SQL server) the application has to use.

    Does anybody have a clue how to do this?

    Many thanx!!!!

  2. #2
    khalik
    Guest
    try this....
    change the cost and provider according.....

    If DataEnvironment1.Connections(1).State = 1 Then DataEnvironment1.Connections(1).Close
    With DataEnvironment1.Connections(1)
    .ConnectionString = cost
    .ConnectionTimeout = 5
    .Provider = "MSDataShape"
    .Open
    End With

  3. #3
    makla
    Guest
    What do you mean by 'change the cost' and what is Provider = "MSDataShape" doing ??

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