Jump to content

Connect to number in database


Naskeo
 Share


Go to solution Solved by Tom Wellige,

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

Link to comment
Share on other sites


  • 2 weeks later...
  • Solution

Without having any server trace with the original error messages in it I would guess that the line

NumeroAstreinte = Value

is the problem. That variable is not defined within your function.

 

Unless you haven't defined it as global variable in the Start block, it is not available/visible within the function.

 

Unlike standard VBScript in Call Routing Script all variables MUST be defined.

 

Link to comment
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
 Share


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.