My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Consultar BD desde ASP</title>
</head>
<body>
<h1>Consultar BD desde ASP</h1>

<ul>

<%

' Nos conectamos
Set db = Server.CreateObject("ADODB.Connection")
Dim DB_CONNECTIONSTRING
DB_CONNECTIONSTRING = "Driver={Microsoft Access Driver (*.mdb)};Dbq="
& Server.MapPath("../db/prueba.mdb") & ";"
db.open DB_CONNECTIONSTRING

'Listamos los valores actuales de la base de datos
set rs_listar = Server.CreateObject("ADODB.Recordset")
SQLStr = "SELECT valor FROM datos"
rs_listar.open SQLStr,DB_CONNECTIONSTRING,
adOpenStatic,adLockReadOnly,adCmdText

do while not rs_listar.eof
Response.Write("<li>" + rs_listar("valor"))
rs_listar.MoveNext
loop

rs.close
db.close

%>

</ul>

<br><br>
<hr>
Art&iacute;culo disponible en: <a href="http://lineadecodigo.com/asp/acceder-a-una-base-de-datos-con-asp/">http://lineadecodigo.com/asp/acceder-a-una-base-de-datos-con-asp/</a><br/>
<a href="http://lineadecodigo.com" title="Linea de Codigo">lineadecodigo.com</a>

</body>
</html>

Change log

r188 by vcuervo on Oct 1, 2009   Diff
Consultar BD desde ASP
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 1259 bytes, 45 lines
Powered by Google Project Hosting