Parameter help needed! 
Author Message
 Parameter help needed!

I am trying to learn Vb.NET and the project I am working on requires a
password. I believe I have most of the code correct but there must be
something syntactically that I am not catching because when I run the
application I get an exception message. I am trying to connect to an Access
database. I enclose the code at thye bottom of this message and would really
appreciate some help! Thanks in advance.

Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnOk.Click

OleDbDataAdapter1.SelectCommand = New OleDbCommand()

OleDbDataAdapter1.SelectCommand.Connection = OleDbConnection1

OleDbConnection1.Open()

If txtPass.Text <> "" Then

OleDbDataAdapter1.SelectCommand.CommandText = _

"SELECT PassWord FROM AccessLevelTable WHERE PassWord = ?;"

OleDbDataAdapter1.SelectCommand.CommandType = CommandType.Text


OleDbType.VarChar, 50, "UCase(txtPass.Text)")

passResult = OleDbDataAdapter1.SelectCommand.ExecuteNonQuery()

Else

MessageBox.Show("The password field must be filled in!", "Data entry error",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

End If

OleDbConnection1.Close()

Dim myPassword As New Password(passResult)

If passResult Is "0" Or UCase(passResult.Substring(passResult.Length - 3))
<> "COR" Then

MessageBox.Show("Information Entered is Incorrect, Please Try Again", "Info
Entry Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation)

Else

Dim frmDE As New frmDataE()

frmDE.Show()

End If

End Sub

Private Sub frmPass_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

End Sub

End Class



Tue, 08 Nov 2005 21:18:08 GMT  
 Parameter help needed!
An unhandled exception of type 'System.Data.OleDbException' occured in
system.data.dll and it happens when it gets to the passResult= line.

DaveHarris


Quote:
> Umm... how about an error message and the line that the error is on?




Quote:
> > I am trying to learn Vb.NET and the project I am working on requires a
> > password. I believe I have most of the code correct but there must be
> > something syntactically that I am not catching because when I run the
> > application I get an exception message. I am trying to connect to an
Access
> > database. I enclose the code at thye bottom of this message and would
really
> > appreciate some help! Thanks in advance.

> > Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles btnOk.Click

> > OleDbDataAdapter1.SelectCommand = New OleDbCommand()

> > OleDbDataAdapter1.SelectCommand.Connection = OleDbConnection1

> > OleDbConnection1.Open()

> > If txtPass.Text <> "" Then

> > OleDbDataAdapter1.SelectCommand.CommandText = _

> > "SELECT PassWord FROM AccessLevelTable WHERE PassWord = ?;"

> > OleDbDataAdapter1.SelectCommand.CommandType = CommandType.Text


> > OleDbType.VarChar, 50, "UCase(txtPass.Text)")

> > passResult = OleDbDataAdapter1.SelectCommand.ExecuteNonQuery()

> > Else

> > MessageBox.Show("The password field must be filled in!", "Data entry
error",
> > MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

> > End If

> > OleDbConnection1.Close()

> > Dim myPassword As New Password(passResult)

> > If passResult Is "0" Or UCase(passResult.Substring(passResult.Length -
3))
> > <> "COR" Then

> > MessageBox.Show("Information Entered is Incorrect, Please Try Again",
"Info
> > Entry Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation)

> > Else

> > Dim frmDE As New frmDataE()

> > frmDE.Show()

> > End If

> > End Sub

> > Private Sub frmPass_Load(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles MyBase.Load

> > End Sub

> > End Class



Wed, 09 Nov 2005 00:54:26 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. command-line-parameter-help needed

2. Help needed: Setting parameters in parameter queries

3. Help needed: Setting parameters in parameter queries

4. homework help needed: passing a recordset as a parameter

5. Greenhorn needs Help On Recordset Parameter Query

6. Need help passing query parameters in a url

7. Newbie needs help with Crystal Reports parameters

8. Need help on parameters

9. Need help with this WHERE clause in parameter query

10. Need help on ADO commands and parameters

11. Help with SQL parameter query needed!

12. Need help : parameters and procedures

 

 
Powered by phpBB® Forum Software