CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2000
    Location
    Sheffield, UK
    Posts
    52

    MSDataShape Provider

    I want to use the DataShape data provider so that I can retrieve hierachical recordsets for use in a MSHFlexgrid. The problem I have is that I'm expanding on an existing program that has a connection to the DB.

    The existing connection string is done in code and the ADO is used programatically with no other controls or DSN's

    Current connection string is :-
    Provider=SQLOLEDB;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=LORHOST;Data Source=RPC082

    Now I have worked out how to use DataShape but it requires a DSN like:-
    Provider=MSDataShape.1;Persist Security Info=False;Data Source=preorder;Integrated Security=SSPI;Initial Catalog=LORHOST;Data Provider=MSDASQL

    I have tried several permetations but cannot get it to work by specifying the server and DB name. A DSN is out of the question.

    Any idea if it is possible not to use a dsn with this?

    (Sorry this post is so long I hope it makes sense)

    Cheers

    Rob


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: MSDataShape Provider

    'Ref only ActiveX 2.1 lib
    Option Explicit

    Private cn As ADODB.Connection
    Private rs As ADODB.Recordset

    Private Sub Form_Load()
    Dim strSQL As String

    Set cn = New ADODB.Connection
    Set rs = New ADODB.Recordset

    cn.Provider = "MSDataShape"
    cn.ConnectionString = "Data Provider=Microsoft.Jet.OLEDB.4.0;Data Source=f:\vb6\prqnew\prq.MDB"
    cn.Open

    rs.Open "SHAPE {select ProducerID, Name, State from ProducerMSTR} " & _
    "APPEND ({select producerid,tanknumber from TankMSTR} " & _
    "RELATE producerid TO producerid) AS tanks", cn

    Set objGrid.DataSource = rs' obgGrid is Hierarchical flex grid
    End Sub



    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Mar 2000
    Location
    Sheffield, UK
    Posts
    52

    Re: MSDataShape Provider

    Great that is just what I was looking for.

    Cheers

    Rob


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