Spectre5000
August 21st, 2001, 09:22 AM
Good morning all! I have a really interesting question that I am hoping someone out there can answer for me.
I am trying to access an MS SQL 7 database using VB. The code I have (and this is just test data) is:
Dim db as Database
Dim rs1 as Recordset
Dim inum as Integer
set db = OpenDatabase("f:\MSSQL7\data\Martin1_Data.MDF")
set rs1 = db.OpenRecordset("select count (*) from name", dbOpenSnapshot)
inum = rs1(0)
MsgBox ("The number is " & inum)
When I go to run this, I am getting the error
Run-Time Error '3045':
Could not use f:\MSSQL7\data\Martin1_Data.MDF. File is already in use.
This is just a test database, and there are only 2 people here in my company that have access to this. I made
sure that the other person wasn't in the database, and that SQL Enterprise manager wasn't opened. I have
the references MS ActiveX Data Objects 2.1 Library, MS ActiveX Data Objects Recordset 2.5 Library, MS DAO 3.6
Library, and MS Data Binding Collection added to this simple project, and I still get the above error.
Can anyone out there tell me why this is happening, and how I can go about solving this error?
I am trying to access an MS SQL 7 database using VB. The code I have (and this is just test data) is:
Dim db as Database
Dim rs1 as Recordset
Dim inum as Integer
set db = OpenDatabase("f:\MSSQL7\data\Martin1_Data.MDF")
set rs1 = db.OpenRecordset("select count (*) from name", dbOpenSnapshot)
inum = rs1(0)
MsgBox ("The number is " & inum)
When I go to run this, I am getting the error
Run-Time Error '3045':
Could not use f:\MSSQL7\data\Martin1_Data.MDF. File is already in use.
This is just a test database, and there are only 2 people here in my company that have access to this. I made
sure that the other person wasn't in the database, and that SQL Enterprise manager wasn't opened. I have
the references MS ActiveX Data Objects 2.1 Library, MS ActiveX Data Objects Recordset 2.5 Library, MS DAO 3.6
Library, and MS Data Binding Collection added to this simple project, and I still get the above error.
Can anyone out there tell me why this is happening, and how I can go about solving this error?