473,837 Members | 1,543 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.MD B", False, True)
'after I've created my workspace where WS is my workspace, I opend it up and
vb.net recognized it.
DeckUsers = dbCycDeck.OpenR ecordset("USERS ")
SQLString = "USERNAME = 'myLoginName'"
'so far so good up to this point. all of the sudden...error happens here:
DeckUsers.FindF irst(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 2021
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.MD B", False, True)
'after I've created my workspace where WS is my workspace, I opend it up and
vb.net recognized it.
DeckUsers = dbCycDeck.OpenR ecordset("USERS ")
SQLString = "USERNAME = 'myLoginName'"
'so far so good up to this point. all of the sudden...error happens here:
DeckUsers.FindF irst(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.MD B", False, True)
'after I've created my workspace where WS is my workspace, I opend it up and
vb.net recognized it.
DeckUsers = dbCycDeck.OpenR ecordset("USERS ")
SQLString = "USERNAME = 'myLoginName'"
'so far so good up to this point. all of the sudden...error happens here:
DeckUsers.FindF irst(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.OleDbConn ection
Dim conStr As String = "Provider=Micro soft.JET.OLEDB. 4.0;Data Source=" &
Server.MapPath( relatvePathToDa tabase)

con = New OleDb.OleDbConn ection(conStr)
Dim cmdSQL As String = "SELECT blah FROM blah ORDER BY blah"
Dim cmd As New OleDb.OleDbComm and(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.OleDbData Reader =
cmd.ExecuteRead er(CommandBehav ior.CloseConnec tion)

'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.OleDbExce ption
'handle database generated exception here
Catch ex As OleDb.OleDbExce ption
'handle all other exceptions here
Finally
con.Close()
End Try
"Ben" <Be*@discussion s.microsoft.com > wrote in message
news:15******** *************** ***********@mic rosoft.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.MD B", False, True)
> 'after I've created my workspace where WS is my workspace, I opend it
> up and
> vb.net recognized it.
> DeckUsers = dbCycDeck.OpenR ecordset("USERS ")
> SQLString = "USERNAME = 'myLoginName'"
> 'so far so good up to this point. all of the sudden...error happens
> here:
> DeckUsers.FindF irst(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.OleDbConn ection
Dim conStr As String = "Provider=Micro soft.JET.OLEDB. 4.0;Data Source=" &
Server.MapPath( relatvePathToDa tabase)

con = New OleDb.OleDbConn ection(conStr)
Dim cmdSQL As String = "SELECT blah FROM blah ORDER BY blah"
Dim cmd As New OleDb.OleDbComm and(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.OleDbData Reader =
cmd.ExecuteRead er(CommandBehav ior.CloseConnec tion)

'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.OleDbExce ption
'handle database generated exception here
Catch ex As OleDb.OleDbExce ption
'handle all other exceptions here
Finally
con.Close()
End Try
"Ben" <Be*@discussion s.microsoft.com > wrote in message
news:15******** *************** ***********@mic rosoft.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.MD B", False, True)
> 'after I've created my workspace where WS is my workspace, I opend it
> up and
> vb.net recognized it.
> DeckUsers = dbCycDeck.OpenR ecordset("USERS ")
> SQLString = "USERNAME = 'myLoginName'"
> 'so far so good up to this point. all of the sudden...error happens
> here:
> DeckUsers.FindF irst(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.OleDbConn ection
Dim conStr As String = "Provider=Micro soft.JET.OLEDB. 4.0;Data Source=" &
Server.MapPath( relatvePathToDa tabase)

con = New OleDb.OleDbConn ection(conStr)
Dim cmdSQL As String = "SELECT blah FROM blah ORDER BY blah"
Dim cmd As New OleDb.OleDbComm and(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.OleDbData Reader =
cmd.ExecuteRead er(CommandBehav ior.CloseConnec tion)

'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.OleDbExce ption
'handle database generated exception here
Catch ex As OleDb.OleDbExce ption
'handle all other exceptions here
Finally
con.Close()
End Try
"Ben" <Be*@discussion s.microsoft.com > wrote in message
news:15******** *************** ***********@mic rosoft.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.MD B", False, True)
> > 'after I've created my workspace where WS is my workspace, I opend it
> > up and
> > vb.net recognized it.
> > DeckUsers = dbCycDeck.OpenR ecordset("USERS ")
> > SQLString = "USERNAME = 'myLoginName'"
> > 'so far so good up to this point. all of the sudden...error happens
> > here:
> > DeckUsers.FindF irst(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=Micros oft.JET.OLEDB.4 .0;Data Source=" &
Server.MapPath( relatvePathToDa tabase) & ";User
Id=ADDIDHERE;Pa ssword=ADDPASSW ORDHERE"
"Ben" <Be*@discussion s.microsoft.com > wrote in message
news:AB******** *************** ***********@mic rosoft.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.OleDbConn ection
> Dim conStr As String = "Provider=Micro soft.JET.OLEDB. 4.0;Data Source="
> &
> Server.MapPath( relatvePathToDa tabase)
>
> con = New OleDb.OleDbConn ection(conStr)
> Dim cmdSQL As String = "SELECT blah FROM blah ORDER BY blah"
> Dim cmd As New OleDb.OleDbComm and(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.OleDbData Reader =
> cmd.ExecuteRead er(CommandBehav ior.CloseConnec tion)
>
> '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.OleDbExce ption
> 'handle database generated exception here
> Catch ex As OleDb.OleDbExce ption
> 'handle all other exceptions here
> Finally
> con.Close()
> End Try
>
>
> "Ben" <Be*@discussion s.microsoft.com > wrote in message
> news:15******** *************** ***********@mic rosoft.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.MD B", False, True)
> >> > 'after I've created my workspace where WS is my workspace, I opend
> >> > it
> >> > up and
> >> > vb.net recognized it.
> >> > DeckUsers = dbCycDeck.OpenR ecordset("USERS ")
> >> > SQLString = "USERNAME = 'myLoginName'"
> >> > 'so far so good up to this point. all of the sudden...error
> >> > happens
> >> > here:
> >> > DeckUsers.FindF irst(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
23882
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 to use a database table but all I want to do now is to click a command button to display this access report. Any suggestions please ?????
4
3922
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 error, this happens only if try access the report on the SERVER, it I try on my local machine, it works just fine. Any help will be much appreciated. Thanks in advance, Fabian von Romberg
1
8059
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 records and validate added data. My question is..
6
4768
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 appreciated. Thanks in advance
49
14369
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 application is relatively big: around 200 tables, 200 forms and sub-forms, 150 queries and 150 repports, 5GB of data (SQL Server 2000), 40 users. I'm wondering what are the disadvantages of using Access as front-end? Other that it's not...
9
2536
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 installation procedure on each PC on which it is used. I am self-taught from the help files that come with Access 2.0 and from painful experience. I've never attended any type of training course on how to develop databases in Access. I have no idea...
0
12076
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 '/CinemaBookingSystem' Application. -------------------------------------------------------------------------------- ERROR General error Unable to open registry key 'Temporary (volatile) Jet DSN for process
8
9645
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 work from
0
2764
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 product) to install my applications. When the Access Runtime was needed on the system I simply ran 'accessrt.msi' from Microsoft Office Developer discs. When another version of Access (other than Access 2002) was on the system then I simply...
2
19507
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 will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
9827
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9678
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10609
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10263
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9390
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7798
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5838
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4034
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.