Click here to Skip to main content
16,006,749 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionEvents Calling Pin
microuser_200025-Jul-06 21:56
microuser_200025-Jul-06 21:56 
AnswerRe: Events Calling Pin
_Chosen25-Jul-06 22:33
_Chosen25-Jul-06 22:33 
QuestionDisplay Enumeration Value In DataGrid Pin
Tamimi - Code25-Jul-06 20:13
Tamimi - Code25-Jul-06 20:13 
AnswerRe: Display Enumeration Value In DataGrid Pin
Christian Graus25-Jul-06 20:42
protectorChristian Graus25-Jul-06 20:42 
GeneralRe: Display Enumeration Value In DataGrid Pin
Tamimi - Code25-Jul-06 21:05
Tamimi - Code25-Jul-06 21:05 
GeneralRe: Display Enumeration Value In DataGrid Pin
Christian Graus25-Jul-06 21:22
protectorChristian Graus25-Jul-06 21:22 
GeneralRe: Display Enumeration Value In DataGrid Pin
Tamimi - Code25-Jul-06 21:26
Tamimi - Code25-Jul-06 21:26 
QuestionUser Validation problem [modified] Pin
slSoftware25-Jul-06 19:05
slSoftware25-Jul-06 19:05 
****This is my component coding****

Public Class DepartmentValidator
Inherits System.ComponentModel.Component

Private empid As String
Private pwd As String

Public Property EmployeeID() As String
Get
Return empid
End Get
Set(ByVal Employeeid As String)
empid = Employeeid
End Set
End Property
Public Property Password() As String
Get
Return pwd
End Get
Set(ByVal Password As String)
pwd = Password
End Set
End Property
Public Function Validate() As Boolean
Dim em As String
Dim pw As String

Dim conn As New OleDb.OleDbConnection("provider=SQLOLEDB;User ID=saassword=;Trusted_Connection=yes;Initial Catalog=employees;data source=localhost")
Try
conn.Open()
Catch ex As Exception
MsgBox("There have problem in connecting to database")
End Try

Dim selectemp As OleDb.OleDbCommand = New OleDb.OleDbCommand("select cempid,cpassword from employees where cEmpID=?", conn)
Dim dr As OleDb.OleDbDataReader
dr = selectemp.ExecuteReader()

Do While dr.Read = True
em = dr.GetString(0)
pw = dr.GetString(12)
If (em = empid And pw = pwd) Then
Return True
Else
Return False
End If
Loop

dr.Close()

*****This is user validation form coding***
Private Sub btnok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnok.Click
Dim validator As DepartmentValidator
validator = New DepartmentValidator
validator.EmployeeID = txtempid.Text
validator.Password = txtpwd.Text
validator.Validate()
If validator.Validate = True Then
MsgBox("Valid User")
Else
MsgBox("Invalid user")
End If

when i'm run this and type employee id and password there display the error in my component codings. Error is like below

An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll

Additional information: ExecuteReader requires an open and available Connection. The connection's current state is Closed.


Could someone help solve 4 this problem pls,if need my coding also ask frm me
Thank YouSmile | :)






-- modified at 1:06 Wednesday 26th July, 2006
AnswerRe: User Validation problem Pin
MHASSANF25-Jul-06 21:27
MHASSANF25-Jul-06 21:27 
Questionautofill textbox from external application Listview [modified] Pin
cds toecutter25-Jul-06 18:38
cds toecutter25-Jul-06 18:38 
AnswerRe: game name browser Pin
Christian Graus25-Jul-06 18:43
protectorChristian Graus25-Jul-06 18:43 
GeneralRe: game name browser Pin
cds toecutter25-Jul-06 21:04
cds toecutter25-Jul-06 21:04 
QuestionRe: game name browser Pin
cds toecutter27-Jul-06 19:44
cds toecutter27-Jul-06 19:44 
Questionenumerate tray icon Pin
gmq198425-Jul-06 18:25
gmq198425-Jul-06 18:25 
QuestionCreating a counter [modified] Pin
Harold_Wishes25-Jul-06 17:49
Harold_Wishes25-Jul-06 17:49 
QuestionHow do I display a blank Date/Time field? Pin
LarryCar25-Jul-06 16:30
LarryCar25-Jul-06 16:30 
AnswerRe: How do I display a blank Date/Time field? Pin
ChandraRam25-Jul-06 18:59
ChandraRam25-Jul-06 18:59 
QuestionListeners in VB.NET Pin
Joshua Boyle25-Jul-06 10:09
Joshua Boyle25-Jul-06 10:09 
AnswerRe: Listeners in VB.NET Pin
mr_lasseter25-Jul-06 12:54
mr_lasseter25-Jul-06 12:54 
QuestionStrange Error while inserting records Pin
mike_eps25-Jul-06 9:19
mike_eps25-Jul-06 9:19 
AnswerRe: Strange Error while inserting records Pin
mike_eps26-Jul-06 4:23
mike_eps26-Jul-06 4:23 
QuestionUpdating Primary Key after Record Deletion (Access 2003) Pin
Joshua Boyle25-Jul-06 8:49
Joshua Boyle25-Jul-06 8:49 
AnswerRe: Updating Primary Key after Record Deletion (Access 2003) Pin
ChandraRam25-Jul-06 9:03
ChandraRam25-Jul-06 9:03 
GeneralRe: Updating Primary Key after Record Deletion (Access 2003) Pin
Joshua Boyle25-Jul-06 10:07
Joshua Boyle25-Jul-06 10:07 
GeneralRe: Updating Primary Key after Record Deletion (Access 2003) Pin
ChandraRam25-Jul-06 10:12
ChandraRam25-Jul-06 10:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.