allora, premetto che sono un neofita dell ASP, finora ho utilizzato solo il PHP.
Devo creare una pagina asp che si colleghi a un database mysql e prelevi i dati da una tabella
Ecco il codice che uso
Il server è localhost perchè ho installato mysql sul mio pccodice:dbconnessione = "server=localhost;db=pisticci;driver=MySQL;"
codice:<% Set conn = Server.CreateObject("ADODB.Connection") Set comm = Server.CreateObject("ADODB.Command") Set Rs = Server.CreateObject("ADODB.Recordset") conn.CommandTimeout = 40 conn.CursorLocation = 1 conn.ConnectionString = dbConnessione conn.Open comm.ActiveConnection = conn comm.CommandType = 1 comm.CommandText = "SELECT * FROM atti ORDER BY data DESC" Rs.Open comm,,1,1 if not(rs.eof) then %> <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; font-family: Arial" bordercolor="#111111" width="99%" id="AutoNumber1"> <tr> <td width="17%" align="center" valign="top">Data</td> <td width="53%" align="center" valign="top">Titolo</td> <td width="30%" align="center" valign="top">Tipo</td> </tr> <% do while not rs.eof %> <tr> <td width="17%" align="center" valign="top"><%=rs("data")%></td> <td width="53%" align="center" valign="top">"><%=rs("titolo")%></td> <td width="30%" align="center" valign="top"><%=rs("tipo")%></td> </tr> <% rs.movenext loop else response.write("Nessun' atto presente nel database") end if rs.close conn.close set rs = nothing set comm = nothing set conn = nothing %>
Se provo a eseguire questo codice mi da l errore:
"Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][Driver Manager ODBC] Nome origine dati non trovato e driver predefinito non specificato. "
Cosa può essere?

Rispondi quotando