Can some take a look at this and tell me what I am doing wrong and how to
fix it. I an new to ASP.NET
Getting Name "GetMsAccessOldebConnection' is not declared " Error
<%@ Page language="VB" Debug="false" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script language="VB" runat="server">
public shared function GetMsAccessOledbConnection(ByVal dbPath As String,
ByVal dbID As String, ByVal dbPassword As String)
Dim dbConn As OleDbConnection
Dim dbConnStr As String =
String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Da ta Source={0};User
ID={1};Password={2}", dbPath, dbID, dbPassword)
return new OleDbConnection(dbConnStr)
End function
Sub Page_Load(Sender as Object, E as EventArgs)
Dim oConn As OleDbConnection
Dim oComm As OleDbDataAdapter
Dim sConn As String
Dim sComm As String
Dim oDataSet As New DataSet
dim Pathdb as String
Pathdb = String.Format(server.mappath("reports/db/specialk.mdb"))
sComm = "Select LastName, FirstName, Phone FROM tblEmployeeChecklist
where ActiveStatus=" & "Yes"' & "'"
'Usually you would use error-handling here. It is left out to
'make the code as simple as possible.
'Create the connection and command objects
oConn = GetMsAccessOledbConnection(Pathdb, "admin", "")
oComm = New OleDbDataAdapter(sComm, oConn)
'Fill the dataset with the results of the query
oComm.Fill(oDataSet, "Employees")
'Set the grid source to the dataset and bind the data
oGrid.DataSource=oDataSet.Tables("Employees").Defa ultView
oGrid.DataBind()
End Sub