Well now I have a connection string and connection, I think. I am trying to verify by writing the content of the "major" column in the "major" table in the committees.mdb database. (Yes the field and table have the same name.) When I run this code I get a blank browser window. Can you please take a look? Where I want to get to is be able to update the fields in one table's particular record with specific fields from a record selected from a second table. But first I have to connect! Here is my code:
<%@ Page Language="
VB" AutoEventWireup="false" CodeFile="connect.aspx.
vb" Inherits="connect" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script language="
VB" runat="server">
sub Page_Load(sender as Object, e as EventArgs)
'Create a connection string
Dim connString as String
connString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & _
"committees.mdb;"
'Open a connection
Dim objConnection as OleDbConnection
objConnection = New OleDbConnection(connString)
objConnection.Open()
'Specify the SQL string
Dim strSQL As String = "SELECT * FROM major"
'Create a command object
Dim objCommand as OleDbCommand
objCommand = New OleDbCommand(strSQL, objConnection)
'Get a datareader
Dim objDataReader as OleDbDataReader
objDataReader = objCommand.ExecuteReader(CommandBehavior.CloseConn ection)
Dim asd As String
While objDataReader.Read()
asd = objDataReader("major")
Response.Write(asd)
End While
'Close the datareader/db connection
objDataReader.Close()
End Sub
</script>
I have also tried this with the following line
asd = objDataReader(1)