|
-
Oct 6th, 2003, 07:14 AM
#1
Thread Starter
Junior Member
ADO.Net opens AccessDB always in exclusive mode ?
Hi,
i'm using vb.net with ado.net and asp.net:
Scenario:
ASP.Net creates an instance to the vb.net project and vb.net establishes the ado.net connection. But the AccessDB is always opened in exclusive mode ?
this is my connection method in vb:
Function dbopenread(ByVal osql As String) As OleDbDataReader
odbpath = "C:\db\1.mdb"
Dim objConn as New New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & odbpath & ";Jet OLEDB atabase Password=xxx")
objConn.Open()
Dim objCmd As New OleDbCommand(osql, objConn)
Dim objDataReader As OleDbDataReader = objCmd.ExecuteReader
objCmd.Dispose()
objCmd = Nothing
dbopenread = objDataReader
End Function
I also tried "Mode=SHARE DENY NONE" in the connection string?
Any idea ?
Thanks
Oliver
-
Oct 6th, 2003, 07:40 AM
#2
Sleep mode
Are you getting specific error ?
-
Oct 6th, 2003, 07:50 AM
#3
Thread Starter
Junior Member
if i have opened the db exclusive in Access then i get an error with vb:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
My thoughts are:
if many users uses the pages at the same time and have a opened ado connection then ado tries to open the db again it creates perhaps an error ?
thanks
oliver
-
Oct 6th, 2003, 08:08 AM
#4
-
Oct 6th, 2003, 08:17 AM
#5
Thread Starter
Junior Member
i also tried it with a windows app. it's the same like you.
But
Scenario 1:
you can open many different vb.net communications =>no prob
Scanrio 2: Open before in Access exlusive mode the DB => you can't open a connection in VB.
It's seems to be the normal way but curious. VB opens in exclusive mode (you can try a db operations in Access, which requires exclusive mode, for example DB compact and repair and Access tells you, it's already opened in exclusive mode) and can open several connections in exlusive mode too. But if you open in exclusive mode in Access you can't open it in VB ?!
But because it seems normal => it's ok ?!
Thanks
Oliver
-
Oct 6th, 2003, 08:35 AM
#6
Frenzied Member
Re: ADO.Net opens AccessDB always in exclusive mode ?
Originally posted by oma
Hi,
i'm using vb.net with ado.net and asp.net:
Scenario:
ASP.Net creates an instance to the vb.net project and vb.net establishes the ado.net connection. But the AccessDB is always opened in exclusive mode ?
this is my connection method in vb:
Function dbopenread(ByVal osql As String) As OleDbDataReader
odbpath = "C:\db\1.mdb"
Dim objConn as New New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & odbpath & ";Jet OLEDB atabase Password=xxx")
objConn.Open()
Dim objCmd As New OleDbCommand(osql, objConn)
Dim objDataReader As OleDbDataReader = objCmd.ExecuteReader
objCmd.Dispose()
objCmd = Nothing
dbopenread = objDataReader
End Function
I also tried "Mode=SHARE DENY NONE" in the connection string?
Any idea ?
Thanks
Oliver
Close your connection. objConn.Close()
-
Oct 6th, 2003, 08:40 AM
#7
Thread Starter
Junior Member
@devgrp:
connection is closed in another sub. So this makes no difference. You can try my described scenario with your vb source code and you will see, it opens in exclusive mode.
it's a interesting logic => but seems to be normal
-
Oct 6th, 2003, 08:48 AM
#8
Frenzied Member
Why is the connection being closed in another sub. After you read your data close the connection right there.
-
Oct 6th, 2003, 08:53 AM
#9
Sleep mode
Originally posted by DevGrp
Why is the connection being closed in another sub. After you read your data close the connection right there.
I agree ,
oma and how do you close the connection obj if it's dimmed within the function body . As I can see , it's out of scope .
-
Oct 6th, 2003, 11:11 AM
#10
Thread Starter
Junior Member
@pirate
i copied this function from a complex internet SAP solutions and changed for the posting some things. Normally the connection is dimmed outside.
Oliver
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|