CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: MSDataShape

  1. #1
    Guest

    MSDataShape


    I want to create a hierarchical recordset but I can't get the MSDataShape provider to work for some reason. I already tried using both MSDataShape and MSDataShape.1 and setting cursor type to client. I always get the message "Data Source not found and default driver not specified." Here is the code:

    cnn.CursorLocation = adUseClient
    cnn.Provider = "MSDataShape"
    stri = "Provider=MSDataShape.1;Data Source=TestDatabase;" & _
    "Connect Timeout=15;Data Provider=MSDASQL"
    cnn.open stri


  2. #2
    Guest

    Re: MSDataShape

    First of All the syntax you've used is incorrect
    You have

    cnn.CursorLocation = adUseClient
    cnn.Provider = "MSDataShape"
    stri = "Provider=MSDataShape.1;Data Source=TestDatabase;" & _
    "Connect Timeout=15;Data Provider=MSDASQL"
    cnn.open stri



    whereas it should be "connection timeout"
    ie.

    cnn.CursorLocation = adUseClient
    cnn.Provider = "MSDataShape"
    stri = "Provider=MSDataShape.1;Data Source=TestDatabase;" & _
    "Connection Timeout=15;Data Provider=MSDASQL"
    cnn.open stri



    I tried this code with a database that I use and it worked fine.
    the error message you are getting leads me to believe that you have not set up testdatabase as a DSN in your ODBC settings although I may be wrong.
    Hope this helps





  3. #3
    Guest

    Re: MSDataShape

    Ok, thanks...but if I want to use a native oledb provider I don't need a dsn, right?


  4. #4
    Guest

    Re: MSDataShape

    I'm sorry of course you're right. I've never used MSDatashape before but the following works for me using OLEDB (I have no DSN's set up)

    Dim cnn as ADODB.Connection
    set cnn=new ADODB.Connection
    cnn.CursorLocation = adUseClient
    cnn.Provider = "SQLOLEDB"
    With cnn
    .ConnectionString = "User ID=sa;Password=;" & _
    "Data Source=;" & _
    "Initial Catalog="
    End With



    the Data source is the name of the machine that the database resides on and the initial catalog is the name of the database itself.
    Hope this helps.



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

Featured