16/11/2014, 14:43
|
| | | Fecha de Ingreso: julio-2003 Ubicación: Caripito Edo Monagas
Mensajes: 169
Antigüedad: 21 años, 4 meses Puntos: 1 | |
Respuesta: ¿cómo conectar con ASP a una BD access en un hosting compartido? Microsoft Access Driver
<%
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("database.mdb"),"user" , "password"
%>
OLE DB
<%
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("database.mdb"),"user" , "password"
%>
ODBC
<%
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DSNname (ODBC)","user" , "password"
%>
<%
On Error Resume Next '*** Not Show ASP Error ***'
Dim Conn1
Set Conn1 = Server.Createobject("ADODB.Connection")
Conn1.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("mydatabase.mdb"),"" , ""
If Err.Number <> 0 Then
Response.write("(Microsoft Access Driver) Database cannot connect Error = "&Err.Description&"<br>")
Else
Response.write("(Microsoft Access Driver) Database connected.<br>")
End If
Conn1.Close()
Set Conn1 = Nothing
Dim Conn2
Set Conn2 = Server.Createobject("ADODB.Connection")
Conn2.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("mydatabase.mdb"),"" , ""
If Err.Number <> 0 Then
Response.write("(OLE DB) Database cannot connect Error = "&Err.Description&"<br>")
Else
Response.write("(OLE DB) Database connected.<br>")
End If
Conn2.Close()
Set Conn1 = Nothing
Dim Conn3
Set Conn3 = Server.Createobject("ADODB.Connection")
Conn3.open "mydatabase","",""
If Err.Number <> 0 Then
Response.write("(ODBC) Database cannot connect Error = "&Err.Description&"<br>")
Else
Response.write("(ODBC) Database connected.<br>")
End If
Conn3.Close()
Set Conn3 = Nothing
%>
Última edición por RucarMaN; 16/11/2014 a las 14:47
Razón: faklto algo
|