Re: Any Recordset stays empty when using SQL Native Client
- From: "Predius" <Predius@xxxxxxxxxxxxxx>
- Date: Thu, 9 Nov 2006 15:14:18 +0100
"Ralph" <nt_consulting64@xxxxxxxxx> schrieb im Newsbeitrag
news:L-OdnfLPIeXvis7YnZ2dnUVZ_vadnZ2d@xxxxxxxxxxxxxxx
"Predius" <Predius@xxxxxxxxxxxxxx> wrote in message
news:uux4QM%23AHHA.3604@xxxxxxxxxxxxxxxxxxxxxxx
Hello,Native
I am trying to switch a VB6 application from SQLOLEDB to SQLNCLI (SQL
Client) in order to use the new features of SLQ Server 2005. Anany
ADODB.Connection seems to work so far, but as soon as I try to retrieve
data my Recordsets stay emtpy although the queries arrive correctly atrecordsaffected,
the
Server and *should* return data (veryfied with SQL Profiler).
'Example code:
Dim con As New ADODB.Connection
Dim recordset1 As New ADODB.Recordset
Dim recordset2 As New ADODB.Recordset
Dim recordsaffected As Integer
con.ConnectionString = "Provider=SQLNCLI.;" _
& "Server=someserver;" _
& "Database=somedb;" _
& "Integrated Security=SSPI;" _
& "DataTypeCompatibility=80;" _
& "MARS Connection=True;"
con.Open
Set recordset1 = con.Execute("SELECT * FROM sometable",
adCmdText)code
Set recordset2 = con.Execute("SELECT * FROM sometable2",
recordsaffected, adCmdText)
con.Close
Set con = Nothing
'End of example
Has anybody got a clue for me, I'm rather stumped. According to MS this
segment should work with ADO.
My ADO Version referenced by VB6 is 2.81.1117.0 whis is the actual
Version
of XP (xpsp_sp2_rtm.040803-2158).
I have the odd feeling that my Connectionstring is missing something
essential.
SQL Server 2005
SQL Native Client OLE DB Provider
http://www.connectionstrings.com/
Parameter names shouldn't have spaces.
Enumerate the complete ADODB.Connection Errors Collection.
Abandon the "As New" declares. This construct can hide non-instancing.
Take a look at the article "Using Data Link" (Index on "Data Link") in the
Windows Help. [Start->Help]. Using a UDL file is a quick way to
build/assemble a connection string and test it within your problem domain.
As opposed to peck 'n test in code.
hth
-ralph
I got it! The essential part missing in the connection string was the cursor
location. I had to indicate a client side cursor and then it worked.
.
- Follow-Ups:
- References:
- Prev by Date: Re: Any Recordset stays empty when using SQL Native Client
- Next by Date: Re: Any Recordset stays empty when using SQL Native Client
- Previous by thread: Re: Any Recordset stays empty when using SQL Native Client
- Next by thread: Re: Any Recordset stays empty when using SQL Native Client
- Index(es):
Relevant Pages
|