When connecting to access I get a NO CONNECTION ERROR

  • Thread starter Eduardo@Merritt Island
  • Start date
E

Eduardo@Merritt Island

I am using ASP.Net 2005

I transcribe a simple code that I have from 2003 and

the system gives me the following error



ExecuteScalar: Connection property has not been initialized.



This is my code:



Dim conUsers As OleDbConnection

Dim strSelect As String

Dim cmdUsers As New OleDbCommand

conUsers = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Inetpub\wwwroot\HomeWeb\App_Data\Home_website.mdb")

strSelect = ("select Position from security where User=? and Password =?")

cmdUsers.Parameters.AddWithValue("@user", TextBox1.Text)

cmdUsers.Parameters.AddWithValue("@Password", TextBox2.Text)

conUsers.Open()________________________________ERROR OCCURS HERE

Label6.Text = cmdUsers.ExecuteScalar.ToString

conUsers.Close()



I have no problem using it in VB

I would appreciate if any one has run into this problem when connecting to
Access

Thank you for any Assistance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top