Jump to content
Naskeo

Connect to number in database

Recommended Posts

Hello all,

 

I try to made a script who search number in database for rooting call. 

My script is:

 

Function ChoixNumeroAstreinte()

Dim Con, Rec, SQL, Value, NumeroSemaine

'Numéro de semaine
NumeroSemaine= DatePart("ww",date)

'Création de la connexion
Set Con = CreateObject("ADODB.Connection")

'Se connecte à la base de données
Con.Open "DRIVER={MySQL ODBC 8.0 Unicode Driver};Server=xxxxxxx;Database=Astreinte;Uid=root;Password=xxxxx"

'Recherche du numéro d'astreinte dans la base de données
Set Rec = Con.Execute("SELECT * FROM Numero WHERE Nom = 'Astreinte' and Semaine = '"& NumeroSemaine &"' ")

'Retour du numéro d'astreinte
Value= Rec.Fields ("Numero").Value
NumeroAstreinte = Value

'Ferme tout
Rec.Close
Set Rec=nothing
Con.Close
Set Con=nothing

End function

 

This script works on vbs but not in swyx. I put this script in Start Rule and the rule is like this

image.thumb.png.3bab4ca78bd065457b6c388a113c4ea4.png

 

Is someone can help me?

 

Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×