views:

30

answers:

2

Trying to switch to SQLNCLI so I can use varchar(max) fields in my ASP application. No records are returned from a query that worked fine under SQLOLEDB.

The connection string opens as follows:

ConnStr="Provider=SQLNCLI10;Server=129.118.139.78,8888;Server=UWCTest;Uid=user;Pwd=pass;DataTypeCompatibility=80;MARS Connection=true;"
oConn.Open connStr

and the code to get the recordset is as follows:

sSQL="usp_tutors_active_select"

Set dbCommand = Server.CreateObject("ADODB.Command")    
Set dbCommand.ActiveConnection = oConn  
dbCommand.CommandType = adCmdStoredProc 
dbCommand.Commandtext=sSQL  


set oRST=dbCommand.Execute

Response.Write orst("firstname")
do while not datacommand1.EOF
    Response.Write "<option value=" & orst("firstname") & ">" & orst("firstname")

    orst.MoveNext
loop
+1  A: 

Try adding SET NO COUNT ON to the top of usp_tutors_active_select. I seem to remember having this issue before.

Martin Smith
Hmm, maybe not actually. I remember it causing some issue with ADO but perhaps not that. This discussion may be relevant. http://www.eggheadcafe.com/software/aspnet/31753706/transactions-in-sql-serve.aspx I'd probably use SQL Profiler to investigate - capture the row count column.
Martin Smith
A: 

Turns out I needed to install the SQLCNI provider on the server; the actual error that was masked by the apparently empty recordset was actually a "provider not found."

Caveatrob