G
Goran
I'm a student and I've just started to learn Visual Studio.NET. I have
a project to make a web application.
I have a problem to connect to the database and retriving the PassType
of the tblEmployee.
First I create Bussines Object user.vb and I declare in it:
Public Class EmployeeDetails
Public EmpIdNo As Integer
Public Name As String
Public Pass As String
Public PassType As String
Public Mobile As String
Public Email As String
Public Jobposition As String
Public Section As String
Public Group As String
Public Other As String
End Class
After I need to have a function for getting the employee details that
are already in the Database.
Public Class Employee
Private objConn As New OleDbConnection("Provider=SQLOLEDB.1;" &
_
"Password=test;Persist Security Info=True;User ID=test;" & _
"Initial Catalog=CC_3;Data Source=05PCSTUDENT1")
Public Function GetEmpDetails(ByVal EmpIDNo As Integer) As
EmployeeDetails
Dim objCmd As New OleDbCommand( _
"SELECT * FROM tblEmployee" & _
"WHERE tblEmployee.Name = @Name AND tblEmployee.Pass =
@Pass", objConn)
Dim objReader As OleDbDataReader
Try
objConn.Open()
objReader = objCmd.ExecuteReader
Catch e As OleDbException
Throw e
End Try
Dim objDetails As New EmployeeDetails
While objReader.Read
With objDetails
.EmpIdNo = objReader.GetFloat(0)
.Name = objReader.GetString(1)
.Pass = objReader.GetString(2)
.PassType = objReader.GetString(3)
.Mobile = objReader.GetString(4)
.Email = objReader.GetString(5)
.Jobposition = objReader.GetString(6)
.Section = objReader.GetString(7)
.Group = objReader.GetString(8)
.Other = objReader.GetString(9)
End With
End While
objReader.Close()
Return objDetails
End Function
end class
So from here I need the PassType so that on login I can compare the
Name, Password and Password Type.
I have a login.aspx page for this application. What should I write in
it so that I can retrive the PassType information from the DataBase
that I can after compare and eventualy to login.
Probably I have lots of mistakes but I'm a starter so I don't yet know
the whole syntax.
Thanx,
Goran
a project to make a web application.
I have a problem to connect to the database and retriving the PassType
of the tblEmployee.
First I create Bussines Object user.vb and I declare in it:
Public Class EmployeeDetails
Public EmpIdNo As Integer
Public Name As String
Public Pass As String
Public PassType As String
Public Mobile As String
Public Email As String
Public Jobposition As String
Public Section As String
Public Group As String
Public Other As String
End Class
After I need to have a function for getting the employee details that
are already in the Database.
Public Class Employee
Private objConn As New OleDbConnection("Provider=SQLOLEDB.1;" &
_
"Password=test;Persist Security Info=True;User ID=test;" & _
"Initial Catalog=CC_3;Data Source=05PCSTUDENT1")
Public Function GetEmpDetails(ByVal EmpIDNo As Integer) As
EmployeeDetails
Dim objCmd As New OleDbCommand( _
"SELECT * FROM tblEmployee" & _
"WHERE tblEmployee.Name = @Name AND tblEmployee.Pass =
@Pass", objConn)
Dim objReader As OleDbDataReader
Try
objConn.Open()
objReader = objCmd.ExecuteReader
Catch e As OleDbException
Throw e
End Try
Dim objDetails As New EmployeeDetails
While objReader.Read
With objDetails
.EmpIdNo = objReader.GetFloat(0)
.Name = objReader.GetString(1)
.Pass = objReader.GetString(2)
.PassType = objReader.GetString(3)
.Mobile = objReader.GetString(4)
.Email = objReader.GetString(5)
.Jobposition = objReader.GetString(6)
.Section = objReader.GetString(7)
.Group = objReader.GetString(8)
.Other = objReader.GetString(9)
End With
End While
objReader.Close()
Return objDetails
End Function
end class
So from here I need the PassType so that on login I can compare the
Name, Password and Password Type.
I have a login.aspx page for this application. What should I write in
it so that I can retrive the PassType information from the DataBase
that I can after compare and eventualy to login.
Probably I have lots of mistakes but I'm a starter so I don't yet know
the whole syntax.
Thanx,
Goran