web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics RMS (Archived)

Hook and Connection to SQL

(0) ShareShare
ReportReport
Posted on by

Can i perform a connection to sql server 2005 on a hook using ADO?

How can i do that cause im trying without any result

this is my code

Dim Value_Need As String

Dim cnn As ADODB.Connection
Dim rst As
ADODB.Recordset

Set cnn = New Connection
Set rst = New Recordset
 cnn.Open "Provider=SQLNCLI;Server=ServerRMS;Database=RMSSampleDB;Uid=sa; Pwd=P@$$W0RD;", "sa", "P@$$W0RD"
                ' abrir el recordset indicando la tabla a la que queremos acceder
                rst.Open "SELECT Password  FROM Cashier WHERE Number = " & "'" & LastCashier & "'", cnn, adOpenDynamic, adLockOptimistic
                ' Asignar los nombres de los campos al combo
                If Not rst.EOF And Not rst.BOF Then
                    rst.MoveFirst
                  Value_Need = rst.Fields("Password")
                Else
                   Value_Need = ""
                End If
                ' Cerrar el recordset y la conexión
                rst.Close
                cnn.Close

but getting error looks like i dont have register the dll for ADO connection but i verify and i have the same version.

If i try this code on a winform or class works fine but in the hook cant make work.

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    i have solution sorry for post but if some else have the same error here is my solution

    just change this lines.

    Dim cnn

    Dim rst

    Set cnn = CreateObject("ADODB.Connection")

    Set rst = CreateObject("ADODB.Recordset")

  • Suggested answer
    TimB Profile Picture
    1,175 on at

    I see that your last post is a solution that will work. It's called late binding.

    You can also use the method in your first post, you will just need to add a reference to "Microsoft ActiveX Data Objects", file name ADODB.dll

    Thank you.

    TimB

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics RMS (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans