Using SQL2k. When I run the command below in query analyzer I get 3 columns
of info. However, when I run the same SELECT from code I get nothing. Can
anyone help? Thanks.
SELECT SERVERPROPERTY('productversion') As SQLVersion,
SERVERPROPERTY('productlevel') As ProdLevel, SERVERPROPERTY('edition') As
SQLEdition
p.s. I want to display this on a VB form. All other commands using my
connection run fine.
DavidDavid Chase (dlchase@.lifetimeinc.com) writes:
> Using SQL2k. When I run the command below in query analyzer I get 3
> columns of info. However, when I run the same SELECT from code I get
> nothing. Can anyone help? Thanks.
> SELECT SERVERPROPERTY('productversion') As SQLVersion,
> SERVERPROPERTY('productlevel') As ProdLevel, SERVERPROPERTY('edition') As
> SQLEdition
> p.s. I want to display this on a VB form. All other commands using my
> connection run fine.
It would certainly help if you posted your VB code, as it's likely
that's where the problem is.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Here is the code.
Set cn = New ADODB.Connection
cn.Open gstrSQLConString
Set rs1 = New ADODB.Recordset
Set rs1 = cn.Execute(strSQL)
strSQL = "SELECT SERVERPROPERTY('productversion') As SQLVersion," & _
" SERVERPROPERTY('productlevel') As ProdLevel," & _
" SERVERPROPERTY('edition') As SQLEdition"
Set rs1 = cn.Execute(strSQL)
If Not rs1.EOF Then
Me.txtCoAddress = CStr(rs1("SQLVersion"))
End If
David
p.s. Just above this code is an identical recordset retrieval that works
perfect.
"Erland Sommarskog" <esquel@.sommarskog.se> wrote in message
news:Xns97AA6601BD26Yazorman@.127.0.0.1...
> David Chase (dlchase@.lifetimeinc.com) writes:
> It would certainly help if you posted your VB code, as it's likely
> that's where the problem is.
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/pr...oads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodin...ions/books.mspx|||David Chase (dlchase@.lifetimeinc.com) writes:
> Here is the code.
> Set cn = New ADODB.Connection
> cn.Open gstrSQLConString
> Set rs1 = New ADODB.Recordset
> Set rs1 = cn.Execute(strSQL)
> strSQL = "SELECT SERVERPROPERTY('productversion') As SQLVersion," & _
> " SERVERPROPERTY('productlevel') As ProdLevel," & _
> " SERVERPROPERTY('edition') As SQLEdition"
> Set rs1 = cn.Execute(strSQL)
> If Not rs1.EOF Then
> Me.txtCoAddress = CStr(rs1("SQLVersion"))
> End If
> David
> p.s. Just above this code is an identical recordset retrieval that works
> perfect.
Apparently, there is more to it. I tried your code in the attached
VB form, and it seemed to work fine.
Which version of ADO do you use?
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment