Re: Data Shaping in VB6

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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
>
>
>
.



Relevant Pages

  • Re: SqlConnection in ReadOnly Mode
    ... It's possible in Access Database using OleDb by specifying in connection string, But I'm unable to find it in sql server. ... If so, and you don't want users to have read-only database access through that application, then don't write any DML / DDL functionality into it... ...
    (microsoft.public.dotnet.framework.adonet)
  • connect to Access DB via IP address
    ... Like SQL Server, is it possible to build the connection string using IP ... address for retrieving data from Access DB? ... of using VPN is the only solution to connect Access database in data center. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: ADO.NET security in Windows App?
    ... my MSDN search provides a bunch of information not relevant to my ... > connection string as well as all data you send between client/server. ... >> with both a MS Access database and an MS SQL Server 2000 database. ...
    (microsoft.public.dotnet.security)
  • Help! Microsoft Access 2003 issue with linked tables.
    ... I have a Microsoft Access database and tables are linked to the SQL Server ... I use that SQL user in my connection string, ...
    (microsoft.public.access.security)
  • Re: One Connection String for Multiple Users (SQL)
    ... Hitchhiker’s Guide to Visual Studio and SQL Server ... "William Vaughn" wrote: ... This uses the> same connection string for all instances of the application. ...
    (microsoft.public.sqlserver.connect)