hi i've only being studying programming for a year and a half in college so please excuse any stupid questions lol. at college i've been doing a project on
vb.net 2005 but at home i have 2008. at college this code works but at home it doesnt i cant work it out.
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call Openuserdatabase()
SQL = "SELECT * FROM tblUserInformation"
da = New OleDb.OleDbDataAdapter(Sql, con2)
da.Fill(ds, "Users")
End Sub
Private Sub btnLogIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogIn.Click
Do While iCount <= (ds.Tables("Users").Rows.Count) - 1
If txtUsername.Text = ds.Tables("Users").Rows(iCount).Item(4) _
Then
If txtPassword.Text = ds.Tables("Users").Rows(iCount).Item(5) _
Then
UserRow = iCount
frmSelect.Show()
Me.Close()
Exit Do
Else
MsgBox("Please enter correct password")
intLoginCheck = intLoginCheck + 1
txtPassword.SelectAll()
txtPassword.Focus()
Exit Do
End If
Else
iCount = iCount + 1
If iCount = (ds.Tables("Users").Rows.Count) _
Then
MsgBox("User not found")
txtUsername.Text = ""
txtUsername.Focus()
txtPassword.Text = ""
Exit Sub
End If
End If
Loop
It keeps coming back with NullReferenceException was unhandled - object reference not set to an instance of an object. the coding for the connection is in a module and should produce a message box saying the connection is ok after it connects but no message box appears before the first form loads like it does at college. hers the code for the connection:
Code:
Public con As New OleDb.OleDbConnection
Public con2 As New OleDb.OleDbConnection
Public da As OleDb.OleDbDataAdapter
Public ds As New DataSet
Public ds2 As New DataSet
Public ds3 As New DataSet
Public UserRow As Integer
Public iCount As Integer
Public Sub Opendatabase()
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = F:\Rhys Crap\tblCriminal.mdb"
con.Open()
MsgBox("Connection OK")
End Sub
Public Sub Closedatabase()
con.Close()
MsgBox("Connection Closed")
End Sub
Public Sub Openuserdatabase()
con2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = F:\Rhys Crap\tblUsers.mdb"
con2.Open()
MsgBox("Connection OK")
End Sub
the path for the connection is right so i can't work out what is wrong and i need this to work so i can test the rest of my project. please help me
(edit) ok so i've just downloaded 2005 but it still wont work on that. could it be that my system is running on 64bit?