DAO access error w.Ms Access | | |
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. | | | | re: DAO access error w.Ms Access
Ben wrote:[color=blue]
> 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.[/color]
Do you not want to upgrade to ADO.NET? The com interop becomes expensive.
Chris | | | | re: DAO access error w.Ms Access
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:
[color=blue]
> Ben wrote:[color=green]
> > 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.[/color]
>
> Do you not want to upgrade to ADO.NET? The com interop becomes expensive.
>
> Chris
>[/color] | | | | re: DAO access error w.Ms Access
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" <Ben@discussions.microsoft.com> wrote in message
news:15EBD44C-4DB1-4FD0-B452-1754397309DA@microsoft.com...[color=blue]
> 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:
>[color=green]
>> Ben wrote:[color=darkred]
>> > 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.[/color]
>>
>> Do you not want to upgrade to ADO.NET? The com interop becomes
>> expensive.
>>
>> Chris
>>[/color][/color] | | | | re: DAO access error w.Ms Access
wow. thanks, dude!
"Scott M." wrote:
[color=blue]
> 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" <Ben@discussions.microsoft.com> wrote in message
> news:15EBD44C-4DB1-4FD0-B452-1754397309DA@microsoft.com...[color=green]
> > 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:
> >[color=darkred]
> >> 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
> >>[/color][/color]
>
>
>[/color] | | | | re: DAO access error w.Ms Access
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:
[color=blue]
> wow. thanks, dude!
>
> "Scott M." wrote:
>[color=green]
> > 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" <Ben@discussions.microsoft.com> wrote in message
> > news:15EBD44C-4DB1-4FD0-B452-1754397309DA@microsoft.com...[color=darkred]
> > > 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
> > >>[/color]
> >
> >
> >[/color][/color] | | | | re: DAO access error w.Ms Access
Change the connection string to this:
Provider=Microsoft.JET.OLEDB.4.0;Data Source=" &
Server.MapPath(relatvePathToDatabase) & ";User
Id=ADDIDHERE;Password=ADDPASSWORDHERE"
"Ben" <Ben@discussions.microsoft.com> wrote in message
news:ABF9CB8D-39B8-47AC-8B0B-134F5DB1F09C@microsoft.com...[color=blue]
> 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:
>[color=green]
>> wow. thanks, dude!
>>
>> "Scott M." wrote:
>>[color=darkred]
>> > 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" <Ben@discussions.microsoft.com> wrote in message
>> > news:15EBD44C-4DB1-4FD0-B452-1754397309DA@microsoft.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
>> > >>
>> >
>> >
>> >[/color][/color][/color] |  | Similar Visual Basic .NET bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,327 network members.
|