473,806 Members | 2,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

change the location of Access

Hi folks. I'm trying to change the location of the Access mdb file I
connect to using OleDb and am having trouble. I'm using Visual C# 2005

and the default values I use for the ConnectionStrin g are those
generated by the Server Explorer. I can connect just fine using the
default values.

But when I comment out strDefaultConne ctionFile and uncomment the
dbName variable I get:
'OleDbException : Could not use "; file already in use.' During testing

I select the exact same path and file that are used in the default, and

I have confirmed this by copying both 'runtime' strings to a text file
and comparing them.
So the two strings are identical. But the 2nd fails. Of course, I
close the debugger when switching between strings and have confirmed
that there are no locks on the database. And access permissions are
the same for the mdb in both cases. I am baffled!
Code fragments are below. Any help would be appreciated.

//Three strings defined earlier in the code...
strDefaultConne ctionPre =
"Provider=Micro soft.Jet.OLEDB. 4.0;Password="" "";User ID=Admin;Data
Source=";

strDefaultConne ctionFile = @"C:\Program Files\HID\Confi g
Card Production Utility\ConfigC ard.mdb";

strDefaultConne ctionPost = @";Mode=ReadWri te|Share Deny
None;Extended Properties="""" ;Jet OLEDB:System database="""";J et
OLEDB:Registry Path="""";Jet OLEDB:Database Password="""";J et
OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global
Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1; Jet OLEDB:New
Database Password="""";J et OLEDB:Create System Database=False; Jet
OLEDB:Encrypt Database=False; Jet OLEDB:Don't Copy Locale on
Compact=False;J et OLEDB:Compact Without Replica Repair=False;Je t
OLEDB:SFP=False ";

//Code fragment of a method called to define the data
source at runtime...

if (openFileDialog 1.ShowDialog() == DialogResult.OK )
{
if ((testStream = openFileDialog1 .OpenFile()) == null)
{
testStream.Clos e();
return false;
}
//Install the new path and test it.
dbName = openFileDialog1 .FileName;
oleDbConnection 1.ConnectionStr ing =
strDefaultConne ctionPre +
// @dbName +

strDefaultConne ctionFile +

strDefaultConne ctionPost;
if (!TestConnectio n())
{
return false;
}
}
else
return false;

Feb 14 '06 #1
0 1414

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

Similar topics

1
2169
by: JF | last post by:
Hi, I need to change the location of the parent window and after that scroll a little bit (because of "position:fixed" css buttons, which obscure the title). I have window.opener.location.href = "newhreflabel"; window.opener.scrollBy(0, -25);
1
30772
by: denis_bernicky | last post by:
I have been given a database on a CD to do some work on. The only problem is that when I open a form it tells me that the file path //server/database/mydb.mdb is not valid. Of course it isn't valid the whole thing is on my comp at the moment and not even on a network. How can I change this path so that I can work on the database locally and change it back when I put the changes back? Thank you for any help.
1
2262
by: | last post by:
Hello, I have a problem when I try to do this on a aspx page.. Is there anything wrong with this approach? This is the javascript function <Script Language='JavaScript'> function OpenLink(Link){
7
11253
by: Henry | last post by:
I am writing a Windows forms VB.Net/MS SQL application via VS 2003 that utilizes Crystal Reports. I want to be able to dynamically set the report data source at run time. I'm trying to change the the reports "integrated security" from TRUE to FALSE via the "Set Location" dialog in the report designer with no success. It is not intuitive (at least not to me.) I get the following error:
4
6318
by: andreas.w.h.k. :-\) | last post by:
How do I change the address location in the wsdl <wsdl:port name="SearchSoap12" binding="tns:SearchSoap12"> <soap12:address location="http://searchservices/engine/search.asmx" /> </wsdl:port> Anderas
1
9459
by: Marc the Demi-Programmer | last post by:
I am overriding WncProc to make sure my form's location stays within specified parameters. Basically, it has to stay at the top of the screen and not be off to either of the sides. All that works when the form is in its minimal size. However, when the form is maximized using the appropriate button the code that is supposed to set the location is ignored. When the form is switched back to the standard dimensions through the restore...
1
1860
by: pl1987 | last post by:
Hello, i have strange problem. I've simple page with frameset on freeDNS serwer (don't have access to change anything) and the page on mine server. I want to change the title of browser's bar self.parent.document.title = 'my own title'; //or top.document.title = 'my own title'; without result. What suprised me a lot, when i put code for "escaping from frame" function changePage() {
0
1582
by: cht13er | last post by:
Good day all, I'm a newish VBA coder who was taught from Google Groups - so thanks to you all very much! I have run into a minor problem, I hope you can give me some help ... I'm running office 2003 for this one. In excel I have a program running ... and based on the results of an optionbutton (called "Form2.Radio_AllParameters") I want to change the SQL that runs a query in access. If the button is True, the SQL should read "WHERE...
4
4336
by: gagnonconsulting | last post by:
Hi, This is driving me crazy, but I am sure I am missing something simple. I have built an Access 2007 report that shows 2 rows of sales data from each of a bunch of store locations. My table has the date, the location and the sales_amount. I need to have my report group on locations. The resulting rows include a date and the sales_amount, and I have been able to display the sales_amount for a requested date (through a parameter query) and the...
0
9719
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
9598
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
10371
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10373
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
9192
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
7650
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
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3852
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3010
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.