Re: Data Shaping in VB6
- From: MarcoPolo <MarcoPolo@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 17 Jun 2005 04:13:05 -0700
Val
Hi - thanks for the follow-up
I've got several - the following is typical. In this example lngUpdateID is
a long parameter passed to the procedure. It should produce a report
combining a single work record with child records being one or more items of
equipment used on the job.
Set ShpData = New ADODB.Connection
ShpData.Provider = "MSDataShape"
ShpData.Open GetShapeConnection(DBtype)
Set rsRec = New ADODB.Recordset
rsRec.Open "SHAPE {select * from tblWorkUpdates " & _
"WHERE UpdateID = " & lngUpdateID & "} AS WRupdates " & _
"APPEND ({select * from qryEquipmentOnJob} AS Equip " & _
"RELATE UpdateID TO JobUpdateID) AS Equip", ShpData
GetShapeConnection is a public function as follows, to save me having to
enter all this code each time I use Shapes.
Public Function GetShapeConnection(iDBtype As Integer)
' return a connection string to open a shaped recordset
Dim sConn As String
Select Case iDBtype
Case access
sConn = "Data Provider = Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=" & Path & "; " & _
"Persist Security Info=False; " & _
"JET OLEDB:Database Password=" & Password
Case sqlserver
sConn = "Data Provider=SQLOLEDB;" & _
"password=" & Password & ";" & _
"servername=" & ServerName & ";" & _
"user ID=" & UserName & ";" & _
"Initial Catalog=" & ServiceName
End Select
GetShapeConnection = sConn
End Function
As I said, it's fine with a combo of XP+Access, or XP+SQL Server, or
NT+Access. NT+SQL Server is the only combination which fails.
--
Marco
"Val Mazur (MVP)" wrote:
> Hi,
>
> What is your connection string that fails?
>
> --
> Val Mazur
> Microsoft MVP
>
> http://xport.mvps.org
>
>
>
> "MarcoPolo" <MarcoPolo@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:A9D2DBB6-C29C-4D95-8D62-F83623BFC60B@xxxxxxxxxxxxxxxx
> >I have a report using a shape command. It works fine with a SQL Server
> > database under XP, or with an Access database under XP or NT. When I try
> > to
> > run it on SQL Server under NT I get the error "Invalid connection string
> > attribute". I assume I must be missing something in terms of providers,
> > but
> > I'm grasping at straws.
> >
> > The connection to the SQL Server database under NT is fine - non-Shape
> > commands execute as expected.
> > --
> > Marco
>
>
>
.
- References:
- Data Shaping in VB6
- From: MarcoPolo
- Re: Data Shaping in VB6
- From: Val Mazur \(MVP\)
- Data Shaping in VB6
- Prev by Date: restaurer base de données sous windows XP
- Next by Date: VBscript/ADO/add record problem
- Previous by thread: Re: Data Shaping in VB6
- Next by thread: Unable to update modified data via dataset from text box
- Index(es):
Relevant Pages
|
|