473,394 Members | 1,802 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

DAO access error w.Ms Access

Ben
I am trying to migrate my vb6.0 over to vb.net. Here is the error that that
I am stuck with:

Public myDB As DAO.Database
.....
path = System.IO.Path.GetFullPath("..")
myDB = WS.OpenDatabase(path & "\access.MDB", False, True)
'after I've created my workspace where WS is my workspace, I opend it up and
vb.net recognized it.
DeckUsers = dbCycDeck.OpenRecordset("USERS")
SQLString = "USERNAME = 'myLoginName'"
'so far so good up to this point. all of the sudden...error happens here:
DeckUsers.FindFirst(SQLString)

I know my ''myLoginName" name exists and it works fine in 6.0. I couldn't
figure this one. could someone please help, what did I do wrong? It
recognized my path, my db, all the way to my table, but it couldn't query?

I got this error:
"...
Run-time exception thrown : System.Runtime.InteropServices.COMException -
Operation is not supported for this type of object.
....."

Thanks.
Nov 21 '05 #1
6 2003
Ben wrote:
I am trying to migrate my vb6.0 over to vb.net. Here is the error that that
I am stuck with:

Public myDB As DAO.Database
....
path = System.IO.Path.GetFullPath("..")
myDB = WS.OpenDatabase(path & "\access.MDB", False, True)
'after I've created my workspace where WS is my workspace, I opend it up and
vb.net recognized it.
DeckUsers = dbCycDeck.OpenRecordset("USERS")
SQLString = "USERNAME = 'myLoginName'"
'so far so good up to this point. all of the sudden...error happens here:
DeckUsers.FindFirst(SQLString)

I know my ''myLoginName" name exists and it works fine in 6.0. I couldn't
figure this one. could someone please help, what did I do wrong? It
recognized my path, my db, all the way to my table, but it couldn't query?

I got this error:
"...
Run-time exception thrown : System.Runtime.InteropServices.COMException -
Operation is not supported for this type of object.
...."

Thanks.


Do you not want to upgrade to ADO.NET? The com interop becomes expensive.

Chris
Nov 21 '05 #2
Ben
You know, Chris. It's be really nice if I could upgrade to ADO.NET but I
can't find the documents anywhere on how to works with Ms Access. However, i
couldn't find any documents on how to do that. Most books that teaches
ADO.net talks lots about web sql type of dB but nothing on local dB, like Ms
Access. Btw, what are the command, methods, procedure to open an Access file
and workspace? It'd be really nice if I could work ADO.NET cuz there aren't
too much codes to translate I could handle it.

Thanks.

"Chris" wrote:
Ben wrote:
I am trying to migrate my vb6.0 over to vb.net. Here is the error that that
I am stuck with:

Public myDB As DAO.Database
....
path = System.IO.Path.GetFullPath("..")
myDB = WS.OpenDatabase(path & "\access.MDB", False, True)
'after I've created my workspace where WS is my workspace, I opend it up and
vb.net recognized it.
DeckUsers = dbCycDeck.OpenRecordset("USERS")
SQLString = "USERNAME = 'myLoginName'"
'so far so good up to this point. all of the sudden...error happens here:
DeckUsers.FindFirst(SQLString)

I know my ''myLoginName" name exists and it works fine in 6.0. I couldn't
figure this one. could someone please help, what did I do wrong? It
recognized my path, my db, all the way to my table, but it couldn't query?

I got this error:
"...
Run-time exception thrown : System.Runtime.InteropServices.COMException -
Operation is not supported for this type of object.
...."

Thanks.


Do you not want to upgrade to ADO.NET? The com interop becomes expensive.

Chris

Nov 21 '05 #3
Connection to an Access database using ADO.NET:
Dim con As OleDb.OleDbConnection
Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=" &
Server.MapPath(relatvePathToDatabase)

con = New OleDb.OleDbConnection(conStr)
Dim cmdSQL As String = "SELECT blah FROM blah ORDER BY blah"
Dim cmd As New OleDb.OleDbCommand(cmdSQL, con)

Try
con.Open()

'Now, you have an open connection to your Access database and you
can use
'the Command object (cmd) to carry out its instructions. For
example:

'Generate an explicit DataReader from the command
Dim dr As OleDb.OleDbDataReader =
cmd.ExecuteReader(CommandBehavior.CloseConnection)

'Loop through the DataReader extracting each field called "Name"
If dr.HasRows Then
Do While dr.Read
'To examine the field value called "Name", you'd access it like
this: dr.Item("Name"))
Loop
End If

Catch ex As OleDb.OleDbException
'handle database generated exception here
Catch ex As OleDb.OleDbException
'handle all other exceptions here
Finally
con.Close()
End Try
"Ben" <Be*@discussions.microsoft.com> wrote in message
news:15**********************************@microsof t.com...
You know, Chris. It's be really nice if I could upgrade to ADO.NET but I
can't find the documents anywhere on how to works with Ms Access.
However, i
couldn't find any documents on how to do that. Most books that teaches
ADO.net talks lots about web sql type of dB but nothing on local dB, like
Ms
Access. Btw, what are the command, methods, procedure to open an Access
file
and workspace? It'd be really nice if I could work ADO.NET cuz there
aren't
too much codes to translate I could handle it.

Thanks.

"Chris" wrote:
Ben wrote:
> I am trying to migrate my vb6.0 over to vb.net. Here is the error that
> that
> I am stuck with:
>
> Public myDB As DAO.Database
> ....
> path = System.IO.Path.GetFullPath("..")
> myDB = WS.OpenDatabase(path & "\access.MDB", False, True)
> 'after I've created my workspace where WS is my workspace, I opend it
> up and
> vb.net recognized it.
> DeckUsers = dbCycDeck.OpenRecordset("USERS")
> SQLString = "USERNAME = 'myLoginName'"
> 'so far so good up to this point. all of the sudden...error happens
> here:
> DeckUsers.FindFirst(SQLString)
>
> I know my ''myLoginName" name exists and it works fine in 6.0. I
> couldn't
> figure this one. could someone please help, what did I do wrong? It
> recognized my path, my db, all the way to my table, but it couldn't
> query?
>
> I got this error:
> "...
> Run-time exception thrown :
> System.Runtime.InteropServices.COMException -
> Operation is not supported for this type of object.
> ...."
>
> Thanks.


Do you not want to upgrade to ADO.NET? The com interop becomes
expensive.

Chris

Nov 21 '05 #4
Ben
wow. thanks, dude!

"Scott M." wrote:
Connection to an Access database using ADO.NET:
Dim con As OleDb.OleDbConnection
Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=" &
Server.MapPath(relatvePathToDatabase)

con = New OleDb.OleDbConnection(conStr)
Dim cmdSQL As String = "SELECT blah FROM blah ORDER BY blah"
Dim cmd As New OleDb.OleDbCommand(cmdSQL, con)

Try
con.Open()

'Now, you have an open connection to your Access database and you
can use
'the Command object (cmd) to carry out its instructions. For
example:

'Generate an explicit DataReader from the command
Dim dr As OleDb.OleDbDataReader =
cmd.ExecuteReader(CommandBehavior.CloseConnection)

'Loop through the DataReader extracting each field called "Name"
If dr.HasRows Then
Do While dr.Read
'To examine the field value called "Name", you'd access it like
this: dr.Item("Name"))
Loop
End If

Catch ex As OleDb.OleDbException
'handle database generated exception here
Catch ex As OleDb.OleDbException
'handle all other exceptions here
Finally
con.Close()
End Try
"Ben" <Be*@discussions.microsoft.com> wrote in message
news:15**********************************@microsof t.com...
You know, Chris. It's be really nice if I could upgrade to ADO.NET but I
can't find the documents anywhere on how to works with Ms Access.
However, i
couldn't find any documents on how to do that. Most books that teaches
ADO.net talks lots about web sql type of dB but nothing on local dB, like
Ms
Access. Btw, what are the command, methods, procedure to open an Access
file
and workspace? It'd be really nice if I could work ADO.NET cuz there
aren't
too much codes to translate I could handle it.

Thanks.

"Chris" wrote:
Ben wrote:
> I am trying to migrate my vb6.0 over to vb.net. Here is the error that
> that
> I am stuck with:
>
> Public myDB As DAO.Database
> ....
> path = System.IO.Path.GetFullPath("..")
> myDB = WS.OpenDatabase(path & "\access.MDB", False, True)
> 'after I've created my workspace where WS is my workspace, I opend it
> up and
> vb.net recognized it.
> DeckUsers = dbCycDeck.OpenRecordset("USERS")
> SQLString = "USERNAME = 'myLoginName'"
> 'so far so good up to this point. all of the sudden...error happens
> here:
> DeckUsers.FindFirst(SQLString)
>
> I know my ''myLoginName" name exists and it works fine in 6.0. I
> couldn't
> figure this one. could someone please help, what did I do wrong? It
> recognized my path, my db, all the way to my table, but it couldn't
> query?
>
> I got this error:
> "...
> Run-time exception thrown :
> System.Runtime.InteropServices.COMException -
> Operation is not supported for this type of object.
> ...."
>
> Thanks.

Do you not want to upgrade to ADO.NET? The com interop becomes
expensive.

Chris


Nov 21 '05 #5
Ben
now, I can't logged into my database. it keeps telling me permission denied.

So I tried the visual way, by right clicked on "data connection" in explorer
windows. I selected MS Jet 4.0, clicked next, I pointed to the right file,
entered correct login name and password. then test connection, all looks
fine too me, but it keeps telling connection fail... blah blah. It's not
currently opened at all. The password / username is correct.

The thing is I normally opend my database by creating a workspace file in
DAO, then I insert my login name, password there. I can't opened my
workspace file here either. Could someone please help? Thanks.

"Ben" wrote:
wow. thanks, dude!

"Scott M." wrote:
Connection to an Access database using ADO.NET:
Dim con As OleDb.OleDbConnection
Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=" &
Server.MapPath(relatvePathToDatabase)

con = New OleDb.OleDbConnection(conStr)
Dim cmdSQL As String = "SELECT blah FROM blah ORDER BY blah"
Dim cmd As New OleDb.OleDbCommand(cmdSQL, con)

Try
con.Open()

'Now, you have an open connection to your Access database and you
can use
'the Command object (cmd) to carry out its instructions. For
example:

'Generate an explicit DataReader from the command
Dim dr As OleDb.OleDbDataReader =
cmd.ExecuteReader(CommandBehavior.CloseConnection)

'Loop through the DataReader extracting each field called "Name"
If dr.HasRows Then
Do While dr.Read
'To examine the field value called "Name", you'd access it like
this: dr.Item("Name"))
Loop
End If

Catch ex As OleDb.OleDbException
'handle database generated exception here
Catch ex As OleDb.OleDbException
'handle all other exceptions here
Finally
con.Close()
End Try
"Ben" <Be*@discussions.microsoft.com> wrote in message
news:15**********************************@microsof t.com...
You know, Chris. It's be really nice if I could upgrade to ADO.NET but I
can't find the documents anywhere on how to works with Ms Access.
However, i
couldn't find any documents on how to do that. Most books that teaches
ADO.net talks lots about web sql type of dB but nothing on local dB, like
Ms
Access. Btw, what are the command, methods, procedure to open an Access
file
and workspace? It'd be really nice if I could work ADO.NET cuz there
aren't
too much codes to translate I could handle it.

Thanks.

"Chris" wrote:

> Ben wrote:
> > I am trying to migrate my vb6.0 over to vb.net. Here is the error that
> > that
> > I am stuck with:
> >
> > Public myDB As DAO.Database
> > ....
> > path = System.IO.Path.GetFullPath("..")
> > myDB = WS.OpenDatabase(path & "\access.MDB", False, True)
> > 'after I've created my workspace where WS is my workspace, I opend it
> > up and
> > vb.net recognized it.
> > DeckUsers = dbCycDeck.OpenRecordset("USERS")
> > SQLString = "USERNAME = 'myLoginName'"
> > 'so far so good up to this point. all of the sudden...error happens
> > here:
> > DeckUsers.FindFirst(SQLString)
> >
> > I know my ''myLoginName" name exists and it works fine in 6.0. I
> > couldn't
> > figure this one. could someone please help, what did I do wrong? It
> > recognized my path, my db, all the way to my table, but it couldn't
> > query?
> >
> > I got this error:
> > "...
> > Run-time exception thrown :
> > System.Runtime.InteropServices.COMException -
> > Operation is not supported for this type of object.
> > ...."
> >
> > Thanks.
>
> Do you not want to upgrade to ADO.NET? The com interop becomes
> expensive.
>
> Chris
>


Nov 21 '05 #6
Change the connection string to this:

Provider=Microsoft.JET.OLEDB.4.0;Data Source=" &
Server.MapPath(relatvePathToDatabase) & ";User
Id=ADDIDHERE;Password=ADDPASSWORDHERE"
"Ben" <Be*@discussions.microsoft.com> wrote in message
news:AB**********************************@microsof t.com...
now, I can't logged into my database. it keeps telling me permission
denied.

So I tried the visual way, by right clicked on "data connection" in
explorer
windows. I selected MS Jet 4.0, clicked next, I pointed to the right file,
entered correct login name and password. then test connection, all looks
fine too me, but it keeps telling connection fail... blah blah. It's not
currently opened at all. The password / username is correct.

The thing is I normally opend my database by creating a workspace file in
DAO, then I insert my login name, password there. I can't opened my
workspace file here either. Could someone please help? Thanks.

"Ben" wrote:
wow. thanks, dude!

"Scott M." wrote:
> Connection to an Access database using ADO.NET:
>
>
> Dim con As OleDb.OleDbConnection
> Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;Data Source="
> &
> Server.MapPath(relatvePathToDatabase)
>
> con = New OleDb.OleDbConnection(conStr)
> Dim cmdSQL As String = "SELECT blah FROM blah ORDER BY blah"
> Dim cmd As New OleDb.OleDbCommand(cmdSQL, con)
>
> Try
> con.Open()
>
> 'Now, you have an open connection to your Access database and
> you
> can use
> 'the Command object (cmd) to carry out its instructions. For
> example:
>
> 'Generate an explicit DataReader from the command
> Dim dr As OleDb.OleDbDataReader =
> cmd.ExecuteReader(CommandBehavior.CloseConnection)
>
> 'Loop through the DataReader extracting each field called
> "Name"
> If dr.HasRows Then
> Do While dr.Read
> 'To examine the field value called "Name", you'd access it
> like
> this: dr.Item("Name"))
> Loop
> End If
>
> Catch ex As OleDb.OleDbException
> 'handle database generated exception here
> Catch ex As OleDb.OleDbException
> 'handle all other exceptions here
> Finally
> con.Close()
> End Try
>
>
> "Ben" <Be*@discussions.microsoft.com> wrote in message
> news:15**********************************@microsof t.com...
> > You know, Chris. It's be really nice if I could upgrade to ADO.NET
> > but I
> > can't find the documents anywhere on how to works with Ms Access.
> > However, i
> > couldn't find any documents on how to do that. Most books that
> > teaches
> > ADO.net talks lots about web sql type of dB but nothing on local dB,
> > like
> > Ms
> > Access. Btw, what are the command, methods, procedure to open an
> > Access
> > file
> > and workspace? It'd be really nice if I could work ADO.NET cuz there
> > aren't
> > too much codes to translate I could handle it.
> >
> > Thanks.
> >
> > "Chris" wrote:
> >
> >> Ben wrote:
> >> > I am trying to migrate my vb6.0 over to vb.net. Here is the error
> >> > that
> >> > that
> >> > I am stuck with:
> >> >
> >> > Public myDB As DAO.Database
> >> > ....
> >> > path = System.IO.Path.GetFullPath("..")
> >> > myDB = WS.OpenDatabase(path & "\access.MDB", False, True)
> >> > 'after I've created my workspace where WS is my workspace, I opend
> >> > it
> >> > up and
> >> > vb.net recognized it.
> >> > DeckUsers = dbCycDeck.OpenRecordset("USERS")
> >> > SQLString = "USERNAME = 'myLoginName'"
> >> > 'so far so good up to this point. all of the sudden...error
> >> > happens
> >> > here:
> >> > DeckUsers.FindFirst(SQLString)
> >> >
> >> > I know my ''myLoginName" name exists and it works fine in 6.0. I
> >> > couldn't
> >> > figure this one. could someone please help, what did I do wrong?
> >> > It
> >> > recognized my path, my db, all the way to my table, but it
> >> > couldn't
> >> > query?
> >> >
> >> > I got this error:
> >> > "...
> >> > Run-time exception thrown :
> >> > System.Runtime.InteropServices.COMException -
> >> > Operation is not supported for this type of object.
> >> > ...."
> >> >
> >> > Thanks.
> >>
> >> Do you not want to upgrade to ADO.NET? The com interop becomes
> >> expensive.
> >>
> >> Chris
> >>
>
>
>

Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nicola | last post by:
Hi Everyone, I am new to programming and would like to know how to open an access Report from within vb 6. I am trying to write a program to organise cross stitch threads. I have found out how...
4
by: Fabian von Romberg | last post by:
Hi, I have installed Sql Reporting Services on 2 machines, one is WIN 2000 PRO and the other one is WIN 2000 ADV. SERVER. When I try to access a report using the webbrowser, I get the following...
1
by: annie | last post by:
Hi all, I have recently ported my Access 2000 app to SQL Server, keeping the Access client as the front end using linked tables. I am also using triggers on my SQL tables to trap orphan...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
49
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The...
9
by: Fish Womper | last post by:
I am at best a part time developer of Access databases. I use Access 2.0, as this is all my employer has on its computers. Even so, to use this ancient version requires a fairly convoluted...
0
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in...
8
by: Greg Strong | last post by:
Hello All, The short questions are 1 Do you know how to make DSN connection close in Access to Oracle 10g Express Edition? &/or 2 Do you know how to make a DSN-less pass-through query...
0
by: Sebastian | last post by:
Hello I develop my applications in Access 2002. My development system is running Windows XP SP2 and I have Microsoft Office XP Developer. Microsoft Office XP is at SP3. I used Inno Setup (great...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.