473,805 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting Oledbconnection datasouce path


I would like to set the DataSource path on my
Oledbconnection so that the Windows application will
always look in the place where the binary is stored when
it looks for the Access database file. How can this be
done?

I tried sticking the function CurDir() into the property
string but I don't seem to be getting the syntax right.
Here is the connection string that I am trying to modify.

=============== =====

Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry
Path=;Jet OLEDB:Database Locking Mode=1;Jet
OLEDB:Database Password=;Data Source="C:\Docu ments and
Settings\Bob\My Documents\Visua l Studio Projects\GoHand s1
\GoHands1\bin\g odanddeaf.mdb"; Password=;Jet OLEDB:Engine
Type=5;Jet OLEDB:Global Bulk
Transactions=1; Provider="Micro soft.Jet.OLEDB. 4.0";Jet
OLEDB:System database=;Jet OLEDB:SFP=False ;Extended
Properties=;Mod e=Share Deny None;Jet OLEDB:New Database
Password=;Jet OLEDB:Create System Database=False; Jet
OLEDB:Don't Copy Locale on Compact=False;J et
OLEDB:Compact Without Replica Repair=False;Us er
ID=Admin;Jet OLEDB:Encrypt Database=False
Nov 20 '05 #1
6 3529
Hi Bob,

You can create a new connection in your form load event, that works, I have
a long time searched for that however it is really that simple.

I hope this helps, if it is not clear be free to ask again?

Cor
Nov 20 '05 #2
See

http://www.kjmsolutions.com/flexible...tionstring.htm

I would like to set the DataSource path on my
Oledbconnection so that the Windows application will
always look in the place where the binary is stored when
it looks for the Access database file.

Nov 20 '05 #3

OK.

I tried putting the new connection in the Form Load event
but I still seem to not know how to properly write the
string with the Curdir() function embedded with in.
Still a novice at this programming stuff.

Here is what I tried and the resulting error...

Private Sub Form1_Load(ByVa l sender As Object, ByVal e
As System.EventArg s) Handles MyBase.Load

'OleDbConnectio n1
'
Me.OleDbConnect ion1.Connection String = "Jet
OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry
Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Jet OLEDB:Database Password=;Data
Source=" + CurDir() + "\godanddeaf.md b"";" & _
"Password=; Jet OLEDB:Engine Type=5;Jet
OLEDB:Global Bulk Transactions=1; Provider=" & _
"""Microsoft.Je t.OLEDB.4.0"";J et OLEDB:System
database=;Jet OLEDB:SFP=False ;Extende" & _
"d Properties=;Mod e=Share Deny None;Jet OLEDB:New
Database Password=;Jet OLEDB:Cr" & _
"eate System Database=False; Jet OLEDB:Don't Copy
Locale on Compact=False;J et OLED" & _
"B:Compact Without Replica Repair=False;Us er
ID=Admin;Jet OLEDB:Encrypt Database=" & _
"False"

Error -
Additional information: Format of the initialization
string does not conform to specification starting at
index 263.


-----Original Message-----
Hi Bob,

You can create a new connection in your form load event, that works, I havea long time searched for that however it is really that simple.
I hope this helps, if it is not clear be free to ask again?
Cor
.

Nov 20 '05 #4
Hi Bob,

I assume that that long connection string is not needed, mostly this is
enough and than I initialize the connection as new however when I write this
now I am in doubt if it is necessary, however I always do it this way, maybe
only adding that connectionstrin g is enough, because logical it should be
that.

dim connString as string = Provider=Micros oft.Jet.OLEDB.4 .0;Data
Source=C:\myacc essfile.mdb;
Oledbconnection 1 = New OleDbConnection (connString)

I hope this helps?
Cor
I tried putting the new connection in the Form Load event
but I still seem to not know how to properly write the
string with the Curdir() function embedded with in.
Still a novice at this programming stuff.

Here is what I tried and the resulting error...

Private Sub Form1_Load(ByVa l sender As Object, ByVal e
As System.EventArg s) Handles MyBase.Load

'OleDbConnectio n1
'
Me.OleDbConnect ion1.Connection String = "Jet
OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry
Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Jet OLEDB:Database Password=;Data
Source=" + CurDir() + "\godanddeaf.md b"";" & _
"Password=; Jet OLEDB:Engine Type=5;Jet
OLEDB:Global Bulk Transactions=1; Provider=" & _
"""Microsoft.Je t.OLEDB.4.0"";J et OLEDB:System
database=;Jet OLEDB:SFP=False ;Extende" & _
"d Properties=;Mod e=Share Deny None;Jet OLEDB:New
Database Password=;Jet OLEDB:Cr" & _
"eate System Database=False; Jet OLEDB:Don't Copy
Locale on Compact=False;J et OLED" & _
"B:Compact Without Replica Repair=False;Us er
ID=Admin;Jet OLEDB:Encrypt Database=" & _
"False"

Error -
Additional information: Format of the initialization
string does not conform to specification starting at
index 263.


-----Original Message-----
Hi Bob,

You can create a new connection in your form load event,

that works, I have
a long time searched for that however it is really that

simple.

I hope this helps, if it is not clear be free to ask

again?

Cor
.

Nov 20 '05 #5

"Bob Achgill" <an*******@disc ussions.microso ft.com> wrote in message
news:11******** *************** ******@phx.gbl. ..

OK.

I tried putting the new connection in the Form Load event
but I still seem to not know how to properly write the
string with the Curdir() function embedded with in.
Still a novice at this programming stuff.

Hello Bob,

In your form_load event change the datasource to just the name of your .mdb
file.

"Data Source = mydatabase.mdb"

There is no need to use the curdir() function just use the relative path in
the form load event.

HTH
Nov 20 '05 #6

"Bob Achgill" <an*******@disc ussions.microso ft.com> wrote in message
news:11******** *************** ******@phx.gbl. ..

OK.

I tried putting the new connection in the Form Load event
but I still seem to not know how to properly write the
string with the Curdir() function embedded with in.
Still a novice at this programming stuff.

Hello Bob,

In your form_load event change the datasource to just the name of your .mdb
file.

"Data Source = mydatabase.mdb"

There is no need to use the curdir() function just use the relative path in
the form load event.

HTH
Nov 20 '05 #7

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

Similar topics

1
2167
by: Job Lot | last post by:
I have written the following function which returns OleDbConnection object. If global variable g_strDbPath contains an invalid file name or path name the catch block throws an error with appropriate error message, but if g_strDbPath is blank then the catch block throws an error saying “No error information available: DB_SEC_E_AUTH_FAILED(0x80040E4D).” In this case connection string is incorrect so why doesn’t it throws as appropriate...
5
13567
by: Tim Bcker | last post by:
Hello. I am trying to get a connection to MySQL using OleDb but it seems that I am making something wrong. Ive found this source in the net but it doesnt work for me: System.Data.OleDb.OleDbConnection con; con=new System.Data.OleDb.OleDbConnection(""); con.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=test;"; con.Open();
0
1939
by: Seth | last post by:
First off, my apologies if this is in the wrong newsgroup, but I hope I'm close enough. I'm trying to do some parsing of a CSV file using OleDbConnection, but for some reason, when I populate my DataSet, it is trimming the trailing spaces. Anybody know why? Here is my code: System.Data.OleDb.OleDbConnection connection = null;
3
2029
by: COHENMARVIN | last post by:
I put the following code in my asp.net page: dbPath = MapPath("/FBDB/db1_newport2003.mdb") strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" strConnect = strConnect & "Data Source=" & dbpath & ";" objConnect = new OleDbConnection(strConnect) ============================= but I get the following error: <b>* Error while updating original data</b>.<br
5
1935
by: David A. Osborn | last post by:
Is there a way to make the OLEDBConnection to my Access file relative to the path of the executable of the file? I work on the program on a lot of different computers and I am tired of having to copy things around so that the Access file is in the right path.
1
6513
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
7
1783
by: Miro | last post by:
I think i have found my problem following an example ive searched for on the net. I am using vb.net 2005 express. What I am looking for is a drag drop from the toolbar that is an OleDbConnectionOleDbConnection and a OleDbDataAdapter so I can drag and drop these on the from, and Connect them to an mdb file. What I think I have come to, is that in 2005 Express you cannot do this.
2
21766
by: Sin Jeong-hun | last post by:
Visual Studio automatically generates DateSet classes and all the other classes automatically at the design time. But is it possible to choose am MDB file at the rum time, and select a table to display, and then display the table contents in the DataGridView? I think, if I do that manually, I must first enumerates all the tables in the MDB, and enumerates all the fileds in that table, and dynamically create a DataSet. But can it be done...
2
3258
by: user | last post by:
Hi everyone, Im using the following conn string in asp.net 1.1 using vb.net: Dim conn As New OleDbConnection("Provider=MS Remote;Remote Server=http://myintranetserver/; Remote Provider=Microsoft.Jet.OLEDB. 4.0;Data Source=c:\pass\be\quiz.mdb;uid=;Password=;") Whenever I execute rs.executereader,
0
9718
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9596
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
10109
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...
1
7649
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
6876
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();...
0
5544
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3847
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
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.