Foros del Web » Programando para Internet » ASP Clásico »

bd access

Estas en el tema de bd access en el foro de ASP Clásico en Foros del Web. hola compañeros soy nuevito por aca agradeceria me ayuden con algunas consultas y de antemano gracias. necesito conectar una base de datos en access tengo ...
  #1 (permalink)  
Antiguo 13/03/2003, 01:21
 
Fecha de Ingreso: marzo-2003
Mensajes: 8
Antigüedad: 22 años, 2 meses
Puntos: 0
bd access

hola compañeros soy nuevito por aca agradeceria me ayuden con algunas consultas y de antemano gracias. necesito conectar una base de datos en access tengo un script en asp pero no hay caso no puedo conectarme a ella no funca para nada algo estoy haciendo mal ayuda plisss.
  #2 (permalink)  
Antiguo 13/03/2003, 06:08
Avatar de carlunchos  
Fecha de Ingreso: enero-2002
Ubicación: no tengo, soy un desubicado?.
Mensajes: 438
Antigüedad: 23 años, 3 meses
Puntos: 1
Hola Marco, bienvenido.

Fijate si te sirve esta tipo de conexion que no utiliza DSN, es decir que no declaraste previamente el nombre de la base en otro lado.

strProvider="Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\nombre_virtual_para el camino fisico a la base que se le da en el PWS") & "\nombre_de_la_base.mdb;"

Luego abris el Connection con strProvider

Te sirve?, sino chifla.

Saludos.
__________________
Carlunchos
  #3 (permalink)  
Antiguo 15/03/2003, 19:14
 
Fecha de Ingreso: marzo-2003
Mensajes: 8
Antigüedad: 22 años, 2 meses
Puntos: 0
hola carlunchos gracias por contestar mira tengo algunos problemillas necesito conectar una base de datos en access
para que un usuario la vea desde internet pero no hay caso me da error tras error o sera que no lo estoy haciendo bien este es el codigo que estoy usando el serv es linux<%
' Declare our variables... always good practice!
Dim strURL ' The URL of this page so the form will work
' no matter what this file is named.

Dim cnnSearch ' ADO connection
Dim rstSearch ' ADO recordset
Dim strDBPath ' path to our Access database (*.mdb) file

Dim strSQL ' The SQL Query we build on the fly
Dim strSearch ' The text being looked for

' Retreive the URL of this page from Server Variables
strURL = Request.ServerVariables("URL")

' Retreive the term being searched for. I'm doing it on
' the QS since that allows people to bookmark results.
' You could just as easily have used the form collection.
strSearch = Request.QueryString("search")

' Since I'm doing this all in one page I need to see if anyone
' has searched for something. If they have we hit the DB.
' O/W I just show the search form and quit.

%>
<p>Search our sample db by first or last name. (% returns all)</p>
<form action="<%= strURL %>" method="get">
<input name="search" value="<%= strSearch %>" />
<input type="submit" />
</form>
<p>[Try 'am' or 'er' for an example]</p>
<%
If strSearch <> "" Then
' MapPath of virtual database file path to a physical path.
' If you want you could hard code a physical path here.
strDBPath = Server.MapPath("datos.mdb")


' Create an ADO Connection to connect to the sample database.
' We're using OLE DB but you could just as easily use ODBC or a DSN.
Set cnnSearch = Server.CreateObject("ADODB.Connection")

' This line is for the Access sample database:
'cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"

' We're actually using SQL Server so we use this line instead:
cnnSearch.Open "Provider=SQLOLEDB;Data Source=10.2.1.214;" _
& "Initial Catalog=samples;User Id=samples;Password=password;" _
& "Connect Timeout=15;Network Library=dbmssocn;"

' Build our query based on the input.
strSQL = "SELECT last_name, first_name, sales " _
& "FROM sample " _
& "WHERE last_name LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
& "OR first_name LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
& "ORDER BY last_name;"

' Execute our query using the connection object. It automatically
' creates and returns a recordset which we store in our variable.
Set rstSearch = cnnSearch.Execute(strSQL)

' Display a table of the data in the recordset. We loop through the
' recordset displaying the fields from the table and using MoveNext
' to increment to the next record. We stop when we reach EOF.
' For fun I'm combining some fields and showwing you can do more then
' just spit out the data in the form it is in in the table.
%>
<table border="1">
<tr>
<th>Name</th>
<th>Sales</th>
</tr>
<%
Do While Not rstSearch.EOF
%>
<tr>
<td><%= rstSearch.Fields("first_name").Value %> <%= rstSearch.Fields("last_name").Value %></td>
<td><%= rstSearch.Fields("sales").Value %></td>
</tr>
<%

rstSearch.MoveNext
Loop
%>
</table>
<%
' Close our recordset and connection and dispose of the objects
rstSearch.Close
Set rstSearch = Nothing
cnnSearch.Close
Set cnnSearch = Nothing
End If
%>

si me puedes ayudar compadre se lo agradeseria mucho
o si tu tiene un codigo mas simple me lo facilites porfabor
biee
  #4 (permalink)  
Antiguo 15/03/2003, 20:27
Avatar de maestro  
Fecha de Ingreso: febrero-2002
Ubicación: España
Mensajes: 2.364
Antigüedad: 23 años, 3 meses
Puntos: 1
Usando linux?, entonces supongo que el server apache.
Salvo que tengas instalado el pack de chillsoft ASP, apache no interpreta scripts en ASP.

Leete las FAQ:
http://www.forosdelweb.com/showthrea...threadid=89836

o estos articulos.
http://aspfacil.com/articulos/verarticulo.asp?id=22
http://aspfacil.com/articulos/verarticulo.asp?id=36

Tienes ejemplos en todos.
__________________
Jose Maria Fernandez
[email protected]
Http://www.expansionweb.net
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:57.