Microsoft KB Archive/175868

= BUG: T-SQL Debugger Does Not Run on NT with User Account =

Article ID: 175868

Article Last Modified on 2/14/2005

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q175868



SYMPTOMS
T-SQL Debugger causes the following error when a stored procedure is called if the Visual Basic 5.0 application is being run on an NT 4.0 or Windows 2000 machine where the login was to a User Account:

"You must have Privledges to modify the registry"

Note The word "Privileges" is misspelled in the error message.

Visual Basic will hang when the application is ended and the task manager must be invoked to shut it down.



RESOLUTION
Use an login account that has administrator rights.



STATUS
This is by design.



Steps to Reproduce Behavior
 Login into an NT or Windows 2000 server with administrator privileges.  Create a stored procedure on Sqlserver 6.5 by running the following code in ISQL/W: CREATE PROCEDURE findstate @whichstate char(2) as     select * from authors where state= @whichstate  Create a Visual Basic Project and check "Microsoft Remote Data Object 2.0" under Project References. Under Add-Ins Manager, check Visual Basic T-SQL Debugger. Under Tools, T_SQL Debugging Option make sure both check boxes are checked. See references mentioned below for setting up T-SQL Debugger.  Place two CommandButtons on the form. Paste the following code in the form:

Note You must change Username= and PWD= to the correct values before you run this code. Make sure that Username has the appropriate permissions to perform this operation on the database. Option Explicit Dim cn As rdoConnection Dim qy As rdoQuery Dim rs As rdoResultset Dim strConnect As String Dim n As Integer

Private Sub Command2_Click rs.Close Set rs = Nothing unload me        End Sub

Private Sub Command1_Click

strConnect = "driver={SQL Server};server=servername;" & _ "database=pubs;Username= ;PWD= ;" rdoEnvironments(0).CursorDriver = rdUseOdbc Set cn = rdoEnvironments(0).OpenConnection( _         dsName:="", _          Prompt:=rdDriverNoPrompt, _          ReadOnly:=False, _          Connect:=strConnect)

Set qy = cn.CreateQuery("sql", _               "{call pubs.dbo.findstate(?) }") qy.RowsetSize = 1 qy.rdoParameters(0) = "CA" Set rs = qy.OpenResultset( _         Type:=rdOpenForwardOnly, _          LockType:=rdConcurReadOnly)

While Not rs.EOF debug.print rs(0) & ", " & rs(1) rs.MoveNext Wend

End Sub  Place a break point on the procedure call line.</li> Run the code and T-SQL debugger should come up.</li> Press the F5 key and it should continue.</li> Close Visual Basic and restart NT. Login to User Account.</li> Open the same project making sure T-SQL debugger is activated.</li> Run the application and the error will appear.</li></ol>

<div class="references_section">