Connexion a une base de donnee mysql

mmahdouch24 Messages postés 2 Date d'inscription dimanche 30 mars 2008 Statut Membre Dernière intervention 26 avril 2008 - 4 avril 2008 à 12:44
cs_ghuysmans99 Messages postés 3982 Date d'inscription jeudi 14 juillet 2005 Statut Membre Dernière intervention 30 juin 2013 - 5 avril 2008 à 01:14
salut,
j'arrive pas a me connecter a ma base de donnee mysql
j'ai crée uj schema intitulé "admission" et ma table "administrateur" voici mon code :

<%
DSN_BASE = "DRIVER={MySQL 5.0.27-community-nt via TCP/IP};" & "SERVER=sql server;" & "PORT=3306;" & "DATABASE=admission;" & "USER=root;" & "PASSWORD=root;"

Set Conn = Server.CreateObject("ADODB.Connection")

Conn.Open DSN_BASE

    log=Request.form("login")
    pass=Request.form("password")
    Set Rs = Server.CreateObject("ADODB.Recordset")
    SQL="SELECT password FROM administrateur where login='" & login & "'"
    RS.open SQL,Conn,adLockPessimistic
    set autRes=Conn.Execute[SQL]
    if autRES.EOF=false then
        if autRES("password") = password then
            Response.Redirect("menu.asp")
    else
            Response.Redirect("erreur.html")
    end if
Conn.Close
set Conn = nothing
%>

voici le message d'erreur qui s'affiche

Erreur de compilation Microsoft VBScripterror '800a0401'

Fin d'instruction attendue

/iisHelp/common/500-100.asp, line 11

Dim objASPError, blnErrorWritten, strServername, strServerIP, strRemoteIP Dim strMethod, lngPos, datNow, strQueryString, strURL
--------------------------------------------------------------------------^

Erreur de compilation Microsoft VBScripterror '800a0401'

Fin d'instruction attendue

/myweb/verification.asp, line 17

set autRes=Conn.Execute[SQL]

j'ai beau essayer ca marche pas
merci de m'aider
-----------------------^

3 réponses

cs_ghuysmans99 Messages postés 3982 Date d'inscription jeudi 14 juillet 2005 Statut Membre Dernière intervention 30 juin 2013 16
4 avril 2008 à 23:27
<%

Public Function Pure(S)
 Pure = Replace(S,"'","''")
End Function

'#################################################################################################################################

Dim DSN_BASE, Conn, login, password, rs
DSN_BASE = "Driver={MySQL ODBC 3.51 Driver};Server=sql server;Port=3306;Database=admission;User=root;Password=root;Option=3;"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open DSN_BASE

login=Request.form("login")
password=Request.form("password")
SQL="SELECT password FROM administrateur where login='" & Pure(login) & "' AND password='" & Pure(password) & "'"
Set rs = Conn.Execute(SQL)
if not(rs.EOF) then
 Response.Redirect("menu.asp")
 else
  Response.Redirect("erreur.html")
end if
rs.Close
Set rs = Nothing

Conn.Close
set Conn = nothing
%>
_______________________________________________________________________
VB.NETis good ...VB6is better
0
mmahdouch24 Messages postés 2 Date d'inscription dimanche 30 mars 2008 Statut Membre Dernière intervention 26 avril 2008
4 avril 2008 à 23:32
merci merci merci et encore merci vous venez de me sauver la vie merci mille fois
0
cs_ghuysmans99 Messages postés 3982 Date d'inscription jeudi 14 juillet 2005 Statut Membre Dernière intervention 30 juin 2013 16
5 avril 2008 à 01:14
Réponse acceptée


_______________________________________________________________________


VB.NET
is good ...
VB6
is better
0
Rejoignez-nous