Search : in
By :

Can't solve error codes

Last answer on Mar 27, 2009 7:58:55 am GMT kdub, on Mar 27, 2009 1:07:26 am GMT 
 Report this message to moderators

Hello, How can I fix this code

' 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

strSQL = "Insert into tblUserActivity (UserIP, FormAccessed) values ('" & _
GetIP4Address() & "', '" & FormAccessed & "')"

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\

Configuration: Windows XP
Internet Explorer 7.0

Best answers for « Can't solve error codes » in :
Know the FTP Error codes Show Know the FTP Error codes Here are the most common FTP process error codes. You will notice these codes in the dialog box in your FTP application, which are very useful to know! Error Codes 110 Restart marker reply. In this case, the...
Error Codes in Windows Show Error Codes in Windows The list below details the error codes displayed in the dialog boxes in Windows: Code Description _________________________________________________________________________ 1 Incorrect function....
Windows Error Codes and How to Fix them ShowWindows Error Codes and How to Fix them Below is a list of the most common error codes that you an face while using Windows and its basic components. Some solutions have been provided for you to try to solve them. You should also note that...
Error code 81000314 - Unable to connect ShowError code 81000314 - Unable to connect When connecting to MSN messenger, the following error message appears on your screen: The opening session. NET Messenger Service failed because the service is temporarily unavailable. Try...
ORA-00600 internal error code, arguments ShowORA-00600 internal error code, arguments This error code is native to internal exceptions from the Oracle programs. It indicates that the process has encountered an unexpected low. It may be due to timeout A corrupted file crash...
Download MSN Explorer ShowMSN To explore is your obligatory stopping on the Web. It introduces a new convivial interface by including all MSN services: MSN Hotmail® MSN Messenger Service MSN Communities MoneyCentral™ MSN eShop MSN Music By inscribing you...
ASCII Code ShowData coding Morse code was the first code used for long-distance communication. Samuel F.B. Morse invented it in 1844. This code is made up of dots and dashes (a sort of binary code). It was used to carry out communication much faster than could...

1

 pro-genius, on Mar 27, 2009 7:58:55 am GMT
  • +5

Give me some time so as i can study the code and come back to you

Reply to pro-genius