' Add your comments here
Imports System.Data
Imports System.Data.OleDb
Imports System
Imports System.Net
Imports Microsoft.VisualBasic
Public Class clsDataLayer
' This function gets the user activity from the tblUserActivity
Public Shared Function GetUserActivity(ByVal Database As String) As dsUserActivity
' Add your comments here
Dim DS As dsUserActivity
Dim sqlConn As OleDbConnection
Dim sqlDA As OleDbDataAdapter
' Add your comments here
sqlConn = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Database & "")
' Add your comments here
sqlDA = New OleDbDataAdapter("select * from tblUserActivity", sqlConn)
' Add your comments here
DS = New dsUserActivity
' Add your comments here
sqlDA.Fill(DS.tblUserActivity)
' Add your comments here
Return DS
End Function
' This function saves the user activity
Public Shared Function SaveUserActivity(ByVal Database As String, ByVal FormAccessed As String)
' Add your comments here
Dim conn As New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Database & "")
conn.Open()
Dim command As OleDbCommand = conn.CreateCommand()
Dim strSQL As String
command.CommandType = CommandType.Text
command.CommandText = strSQL
command.ExecuteNonQuery()
conn.Close()
End Function
' This function gets the IP Address
Public Shared Function GetIP4Address() As String
Dim IP4Address As String = String.Empty
For Each IPA As IPAddress In Dns.GetHostAddresses(HttpContext.Current.Request.UserHostAddress)
If IPA.AddressFamily.ToString() = "InterNetwork" Then
IP4Address = IPA.ToString()
Exit For
End If
Next
If IP4Address <> String.Empty Then
Return IP4Address
End If
For Each IPA As IPAddress In Dns.GetHostAddresses(Dns.GetHostName())
If IPA.AddressFamily.ToString() = "InterNetwork" Then
IP4Address = IPA.ToString()
Exit For
End If
Next
Return IP4Address
End Function
if Not Page.IsPostBack Then
' Declares the DataSet
Dim myDataSet As New dsUserActivity
' Fill the dataset with what is returned from the function
myDataSet = clsDataLayer.GetUserActivity(Server.MapPath("PayrollSystem_DB.mdb"))
' Sets the DataGrid to the DataSource based on the table
grdUserActivity.DataSource = myDataSet.Tables("tblUserActivity")
' Binds the DataGrid
grdUserActivity.DataBind()
End If
End Class
Warning 1 Function 'SaveUserActivity' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used. C:\Documents and Settings\Compaq_Owner\My Documents\Visual Studio 2005\WebSites\PayrollSystem\App_Code\clsDataLayer.vb 50 5 C:\...\PayrollSystem\
Error 2 Statement cannot appear outside of a method body. C:\Documents and Settings\Compaq_Owner\My Documents\Visual Studio 2005\WebSites\PayrollSystem\App_Code\clsDataLayer.vb 80 1 C:\...\PayrollSystem\
Error 3 Declaration expected. C:\Documents and Settings\Compaq_Owner\My Documents\Visual Studio 2005\WebSites\PayrollSystem\App_Code\clsDataLayer.vb 85 1 C:\...\PayrollSystem\
Error 4 Declaration expected. C:\Documents and Settings\Compaq_Owner\My Documents\Visual Studio 2005\WebSites\PayrollSystem\App_Code\clsDataLayer.vb 88 1 C:\...\PayrollSystem\
Error 5 Declaration expected. C:\Documents and Settings\Compaq_Owner\My Documents\Visual Studio 2005\WebSites\PayrollSystem\App_Code\clsDataLayer.vb 91 1 C:\...\PayrollSystem\
Error 6 'End If' must be preceded by a matching 'If'. C:\Documents and Settings\Compaq_Owner\My Documents\Visual Studio 2005\WebSites\PayrollSystem\App_Code\clsDataLayer.vb 92 1 C:\...\PayrollSystem\