I have nearly finished my program and I am now looking over it to clean up any rubbish and trying to make things runs a little quicker.
I have a few global variables that hold options for the program. These options are read in when the program launches.
Would it be better to only read the options in when they are required or to keep it the way i have it.
I guess having global variables will use more memory than if I didn't have them.
The second part of my quiestion is this. I have a few functions in a module to retrieve the ID of a person in the databse. I would like to turn this into a class but am a little unsure on how to do it.
This is what I have in the module.
Now how would i implement this into a class.
Thanks for any help or advice
Steve
I have a few global variables that hold options for the program. These options are read in when the program launches.
Would it be better to only read the options in when they are required or to keep it the way i have it.
I guess having global variables will use more memory than if I didn't have them.
The second part of my quiestion is this. I have a few functions in a module to retrieve the ID of a person in the databse. I would like to turn this into a class but am a little unsure on how to do it.
This is what I have in the module.
Visual Basic:
Function GetNameID(ByVal fname As String, ByVal lname As String)
Dim nameid As Integer
If fname = "NULL" Or lname = "NULL" Then
Return 0
End If
Dim sql As String = "SELECT ID, Surname, Firstname FROM Contacts " & _
"WHERE Surname = '" & lname & "' AND Firstname = '" & fname & "'"
Dim objDsName = New DataSet()
Dim objDaName = New OleDbDataAdapter(sql, cnstring)
objDaName.Fill(objDsName, "TempName")
For Each objrow In objDsName.tables(0).rows
nameid = objrow("ID")
Next
objDsName.dispose()
objDaName.dispose()
Return nameid
End Function
Thanks for any help or advice
Steve