Invoking sp_password via VB

  • Some nuts are our place want to allow users to change their own (local) SQL password, independent of their domain passwords (I said they were nuts)

    But when I tried to help them an interesting point arose. I log in as the (non-sa) user, go to Query Analyzer, issue “sp_password”, and can change the user password. But when I use Visual Basic to invoke sp_password I get “the proc cannot be executed in a user-define transaction”.

    Well then, how is the user supposed to change their SQL password? (A programmatic approach seems better to me than sending them to Query Analyzer.)

    TIA,

    Bill Salkin

  • How are you connecting? I tried with ADO 2.6 against SQL2000 with the following code, no problems:

    Dim cn As ADODB.Connection

    Set cn = New ADODB.Connection

    cn.Open "Provider=SQLOLEDB.1;Password=test;Persist Security Info=True;User ID=TestUser99;Initial Catalog=master;Data Source=eg"

    cn.Execute "sp_password 'test','ok'"

    cn.Close

    Set cn = Nothing

    Andy

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply