<html>
<head>
<script language="vb" runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim stringConnectionString As String
Dim stringSql As String
Dim objConnection As OleDbConnection
Dim objCommand As OleDbCommand
Dim objDataReader As OleDbDataReader
Dim i As Integer
Dim sTemp As String
Dim stringMapPath As String
stringConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="
stringMapPath = Server.MapPath("sampledb.mdb")
stringConnectionString = stringConnectionString & stringMapPath
objConnection = New System.Data.OleDb.OleDbConnection(stringConnectionString)
objConnection.Open()
stringSql = "SELECT * FROM tblSample"
objCommand = New System.Data.OleDb.OleDbCommand(stringSql, objConnection)
objDataReader = objCommand.ExecuteReader()
Response.Write("<table border=1 cellpadding=1 cellspacing=1>")
Do While objDataReader.Read
Response.Write("<tr>")
Response.Write("<td>" & objDataReader.Item("url") & "</td>")
Response.Write("<td>" & objDataReader.Item("desc") & "</td>")
Loop
Response.Write("</table><br><br>")
objDataReader.Close()
objConnection.Close()
End Sub
</script>
</head>
{ 0 nhận xét... read them below or add one }
Đăng nhận xét