M
Mike
Dear Group,
I have a .NET 2.0 .DLL assembly containing a dataset with three tables. I
reference this from a standalone .NET 2.0 EXE. I am writing a login form
which uses the single Dataset from the .NET 2.0 .DLL. One of the tables
(staff) contains a TableAdapter that fills using a single parameter
(@UserName). I am trying to code a simple login form for which I pass a
username and read the password. All is well and fine with this, however I
want to write back to the "lastlogon" column and update it with a timestamp.
I'm only using one table, so this shouldn't be too difficult?
The following code doesn't break at all, but the table never updates. What
am I doing wrong? I'm worried that I might be updating my own TableAdapter
in memory which is disconnected from the database, or my instance of my
TableAdapter isn't connected to the satellite .DLL assembly. The satellite
..DLL assembly is strongly named and the Dataset Strongly Typed. Any ideas?
Thanks in advance for any help!
Dim StaffDT As Staff.STAFFDataTable
Dim StaffTA As StaffTableAdapters.STAFFTableAdapter
StaffDT = New Staff.STAFFDataTable
StaffTA = New StaffTableAdapters.STAFFTableAdapter
StaffTA.FillByUserName(StaffDT, UsernameTextBox.Text)
' Found this username
If StaffDT.Rows.Count = 1 Then
' Check password
If StaffDT.Rows(0).Item("password") = Trim(PasswordTextBox.Text) Then
' Mark this login attempt
StaffDT.Rows(0).Item("lastlogon") = Now()
' Accept Changes
StaffDT.AcceptChanges()
' Commit Changes
StaffTA.Update(StaffDT)
' Show Switchboard (successful login)
ShowSwitchboard()
Else
MsgBox("Incorrect Password", MsgBoxStyle.Exclamation,
My.Application.Info.AssemblyName)
End If
Else
MsgBox("This username cannot be found in the database. Please ask your
system administrator to create a username for you", _
MsgBoxStyle.Exclamation, My.Application.Info.AssemblyName)
End If
I have a .NET 2.0 .DLL assembly containing a dataset with three tables. I
reference this from a standalone .NET 2.0 EXE. I am writing a login form
which uses the single Dataset from the .NET 2.0 .DLL. One of the tables
(staff) contains a TableAdapter that fills using a single parameter
(@UserName). I am trying to code a simple login form for which I pass a
username and read the password. All is well and fine with this, however I
want to write back to the "lastlogon" column and update it with a timestamp.
I'm only using one table, so this shouldn't be too difficult?
The following code doesn't break at all, but the table never updates. What
am I doing wrong? I'm worried that I might be updating my own TableAdapter
in memory which is disconnected from the database, or my instance of my
TableAdapter isn't connected to the satellite .DLL assembly. The satellite
..DLL assembly is strongly named and the Dataset Strongly Typed. Any ideas?
Thanks in advance for any help!
Dim StaffDT As Staff.STAFFDataTable
Dim StaffTA As StaffTableAdapters.STAFFTableAdapter
StaffDT = New Staff.STAFFDataTable
StaffTA = New StaffTableAdapters.STAFFTableAdapter
StaffTA.FillByUserName(StaffDT, UsernameTextBox.Text)
' Found this username
If StaffDT.Rows.Count = 1 Then
' Check password
If StaffDT.Rows(0).Item("password") = Trim(PasswordTextBox.Text) Then
' Mark this login attempt
StaffDT.Rows(0).Item("lastlogon") = Now()
' Accept Changes
StaffDT.AcceptChanges()
' Commit Changes
StaffTA.Update(StaffDT)
' Show Switchboard (successful login)
ShowSwitchboard()
Else
MsgBox("Incorrect Password", MsgBoxStyle.Exclamation,
My.Application.Info.AssemblyName)
End If
Else
MsgBox("This username cannot be found in the database. Please ask your
system administrator to create a username for you", _
MsgBoxStyle.Exclamation, My.Application.Info.AssemblyName)
End If