dont know why....
OK, as i seem to come here a lot about things, I'm going to make this as simple as possible.
I'm having problems with connecting to a file called "userlist.mdb"
it is a database.
i have two subs, and nether work....really being annoying...
Blubb, Jason, or anybody else that can see the problem, can you explain to me why its not working?...
...also, might be noted that I'm using VB.net 2005...
passwords encrypted with a basic AES encryption...
keys are the keys to the passwords, key for all the keys is "Default"....im slack for the moment...
first user is johnsmith, and password for that is Password1
sub 1
[highlight=vb.net]Public Sub dbcheck(ByVal user As String, ByVal password As String)
Try
Dim con As New OleDb.OleDbConnection
Dim dbprovider As String = "PROVIDER=Microsoft.Jet.OlEDB.4.0;"
Dim filelocation As String = ""
Console.WriteLine(filelocation)
Dim dbsource As String = "Data Source =" & filelocation & "userlist.mdb;"
Dim sql As String
Dim Datset As New DataSet
Dim Data_adapt As OleDb.OleDbDataAdapter
con.ConnectionString = dbprovider & dbsource
Try
con.Open()
sql = "SELECT * FROM TBlist"
Data_adapt = New OleDb.OleDbDataAdapter(sql, con)
Data_adapt.Fill(Datset, "usernames")
sql = "SELECT * FROM TBpasswords"
Data_adapt = New OleDb.OleDbDataAdapter(sql, con)
Data_adapt.Fill(Datset, "passwords")
Dim int As Integer = 0
For int = 0 To intusers
userlist(int) = Datset.Tables("usernames")****ws(int).Item(4)
passlist(int) = Datset.Tables("passwords")****ws(int).Item(1)
keylist(int) = Datset.Tables("passwords")****ws(int).Item(2)
Next
int = 0
For int = 0 To intusers
Dim keycheck As String = DEScrypt.decrypt(keylist(int), "Default")
Dim usercheck As String = userlist(int)
Dim passcheck As String = DEScrypt.decrypt(passlist(int), keylist(int))
If user = usercheck Then
If password = passcheck Then
My.Settings.loggedin = True
End If
End If
Next
Catch ex As Exception
Console.WriteLine("Error, could not open file")
End Try
con.Close()
Catch ex As Exception
Console.WriteLine("File not able to be opened")
End Try
End Sub[/highlight]
sub 2
[highlight=vb.net] Public Sub dbcheck2(ByVal user As String, ByVal password As String)
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim datread As OleDbDataReader
Dim filedir As String = "Data Source=userlist.mdb;"
Try
con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " & filedir)
'provider to be used when working with access database
con.Open()
cmd = New OleDbCommand("select username from TBlist", con)
datread = cmd.ExecuteReader
While datread.Read = True
userlist(0) = datread(0)
userlist(1) = datread(1)
userlist(2) = datread(2)
userlist(3) = datread(3)
End While
cmd = New OleDbCommand("select passkey from TBpasswords", con)
datread = cmd.ExecuteReader
While datread.Read = True
keylist(0) = DEScrypt.decrypt(datread(0), "Default")
keylist(1) = DEScrypt.decrypt(datread(1), "Default")
keylist(2) = DEScrypt.decrypt(datread(2), "Default")
keylist(3) = DEScrypt.decrypt(datread(3), "Default")
End While
cmd = New OleDbCommand("select password from TBpasswords", con)
datread = cmd.ExecuteReader
While datread.Read = True
passlist(0) = DEScrypt.decrypt(datread(0), keylist(0))
passlist(1) = DEScrypt.decrypt(datread(1), keylist(1))
passlist(2) = DEScrypt.decrypt(datread(2), keylist(2))
passlist(3) = DEScrypt.decrypt(datread(3), keylist(3))
End While
datread.Close()
con.Close()
Dim int As Integer
For int = 0 To 3
If userlist(int) = user Then
If passlist(int) = password Then
My.Settings.loggedin = True
End If
End If
Next
Catch ex As Exception
Console.WriteLine("Error, file problem")
Console.WriteLine(ex)
Console.ReadLine()
End Try
End Sub[/highlight]
if you see the problem, can you please say it in this form.
function name =
problem
<line that does not work>
- why it does not work
- if possible, how to fix it
thanks if anybody can help, being annoying...
vscans of database=
vscan 1
vscan 2
(not ranked in any order.....)
@
Jason
@
Blubb1337
@
-Rez
@
freedompeace
@
gamer4evere
/post 500
also, if known, what can i do at 500 posts...