VB Databases BasicsBeginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB Databases Basics section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
I'm working through the tutorials in the Wrox VB 2005 starter kit and there's some code that doesn't seem to work. It's the code to check that the user has entered a password correctly on the login screen:
Dim CheckUserDataView As DataView = CheckUserTable.DefaultView
CheckUserDataView.RowFilter = "Name = '" + UserName + "'"
With CheckUserDataView
If .Count > 0 Then
If .Table.Rows(0).Item("Password").ToString.Trim = Password Then
Return True
Else
MessageBox.Show(.Table.Rows(0).Item("Password").To String.Trim)
Return False
End If
Else
Return False
End If
End With
I can see how it should work, but for some reason it always picks the first row from the unfiltered table. In other words, CheckUserDataView.Count is 1, but there seems to be more than 1 item in the filtered dataview. As far as I can see, using the .Table.Rows method returns items from the unfiltered dataview and I can't understand why this should be happening.