Click to See Complete Forum and Search --> : MSDataShape Provider


Rob@SYPTE
August 10th, 2001, 04:00 AM
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

Iouri
August 10th, 2001, 07:07 AM
'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
iouri@hotsheet.com

Rob@SYPTE
August 10th, 2001, 08:09 AM
Great that is just what I was looking for.

Cheers

Rob