473,802 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application.Sta rtupPath and mdb problem

Howdy,

I've spent a good 2 or 3 hours this morning trying to figure out this
code. I'm new to the .Net environment and have some VB6 skills but
that was 3 years ago.

My project I'm working on accesses a Access DB to pull in data. I used
the designer to pull in the components I needed to connect to the
database.

Here is my Code:

Me.OleDbConnect ion1.Connection String = "Jet OLEDB:Global Partial Bulk
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Data Source=""C:\Owe ns\Visual Studio
Projects\Tailor ing\bin\tailori " & _
"ng.mdb"";Mode= Share Deny None;Jet OLEDB:Engine
Type=5;Provider =""Microsoft.Je t.OLE" & _
"DB.4.0"";J et OLEDB:System database=;Jet
OLEDB:SFP=False ;persist security info=Fal" & _
"se;Extende d Properties=;Jet OLEDB:Compact Without Replica
Repair=False;Je t OLEDB" & _
":Encrypt Database=False; Jet OLEDB:Create System
Database=False; Jet OLEDB:Don't C" & _
"opy Locale on Compact=False;U ser ID=Admin;Jet OLEDB:Global
Bulk Transactions=1"

I think this is a bit over kill, but what I'm trying to do is get it
so that I can put in the relative path to the database instead of
literal. However, when I change the datasource path it gives me an
error with my dataset.

Example of that code here:

Dim dbPath as String =
Application.Sta rtupPath & "\tailoring.mdb "

Me.OleDbConnect ion1.Connection String = "Jet OLEDB:Global Partial Bulk
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Data
Source=[b:6e962dc7b3]dbPath[/b:6e962dc7b3];Mode=Share Deny None;Jet
OLEDB:Engine Type=5;Provider =""Microsoft.Je t.OLE" & _
"DB.4.0"";J et OLEDB:System database=;Jet
OLEDB:SFP=False ;persist security info=Fal" & _
"se;Extende d Properties=;Jet OLEDB:Compact Without Replica
Repair=False;Je t OLEDB" & _
":Encrypt Database=False; Jet OLEDB:Create System
Database=False; Jet OLEDB:Don't C" & _
"opy Locale on Compact=False;U ser ID=Admin;Jet OLEDB:Global
Bulk Transactions=1"

This is the Error I get when I attempt to run it with that code.

An unhandled exception of type 'System.Data.Ol eDb.OleDbExcept ion'
occurred in system.data.dll

Code for that line is: OleDbDataAdapte r1.Fill(DataSet 1)

Anyone have any suggestions?

Nov 21 '05 #1
3 2466
Ddraig,

I have send this message this morning to Barkster (and when you see there he
showed that it did work for him)

I can let you search, however I copied it.

I have strugled a longtime with this and it is so easy, just set in the load
event from your form (or whatever place, before the connection object is
used however after that it is initialized) using the connection object you
have created with the designer (and don't change that in the designer
generated code) the connection string.

Someting as
OleDBConnection 1.connectionstr ing = "xxxxxxxxxx xxx" & applicationstar tuppath

Mostly those connection strings do not have that difficult as build with the
designer, have a look at these links for them.

http://www.connectionstrings.com/

http://www.able-consulting.com/ADO_Conn.htm

I hope this helps?

Cor
Nov 21 '05 #2
Ddraig,

I have send this message this morning to Barkster (and when you see there he
showed that it did work for him)

I can let you search, however I copied it.

I have strugled a longtime with this and it is so easy, just set in the load
event from your form (or whatever place, before the connection object is
used however after that it is initialized) using the connection object you
have created with the designer (and don't change that in the designer
generated code) the connection string.

Someting as
OleDBConnection 1.connectionstr ing = "xxxxxxxxxx xxx" & applicationstar tuppath

Mostly those connection strings do not have that difficult as build with the
designer, have a look at these links for them.

http://www.connectionstrings.com/

http://www.able-consulting.com/ADO_Conn.htm

I hope this helps?

Cor
Nov 21 '05 #3
Thanks for the help :) I was able to figure it out it was a problem
with the silly " marks they always get me. :roll:

Nov 21 '05 #4

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

Similar topics

3
34365
by: ALI-R | last post by:
Hi The default direcoty when debugging the appication is always "...\myC#proramme\bin\Debug" and cuases problem because my xml files are in "...\myC#proramme" . Is there a way of getting the root direcoty of my application("...\myC#proramme") in my code? thanks for your time.
5
3139
by: Robert Magnusson | last post by:
Hi All, This is sure to be an easy question. I am wondering what the accepted standard is for referencing a sub-folder below the application.exe folder? In VB6 you simply used App.Path and navigated from the folder indicated. In .Net, however, when running through the IDE, this seems to return either the ...bin/debug or ...bin/release folder - in which case the 'sub-folders' are actually to be found in the .../../ folder.
5
62696
by: Eranga | last post by:
In c# windows applicatiopns the Application.StartupPath can be used to find the path for the executable file. How can the same be found for a console application?(we can't use application because it inherits from the System.Windows.Forms namespace) Thanks in advance. *** Sent via Developersdex http://www.developersdex.com ***
8
3701
by: jcrouse | last post by:
I am trying to run a command from a command prompt using the shell command. Here is the syntax I want to execute: Shell(lblMameExePath.Text & " -listinfo >" & Application.StartupPath & "\MameGames.cfg", AppWinStyle.NormalFocus, True) The problem is that the parameter Application.StartupPath has spaces (C:\Program Files, for instance) and won't execute from a command prompt without being incased in quotes. I can't figure out the...
7
1579
by: Q | last post by:
Hello you all, I have created an application that reads and writes data to a access database. To access the database, I use a System DataSource (Connection string: DSN=MyDataSourceName). If I distribute my application, there is a possibility to add the registry key for the system datasource so that the System DataSource will be created on the machine where the application is
2
2346
by: Ron | last post by:
Hello, I would like to retrieve the startupPath from a console application. It appears that a console application does not recognize Application, so I can't access StartupPath. Is there a way to do this in a console application? Thanks, Ron
3
5967
by: hayworth | last post by:
I had some code to build the name of a file: ' Build the name of the XML config file. g_strFiles.strConfig = My.Computer.FileSystem.CombinePath(Application.StartupPath, "\Settings\Config main.xml") This worked fine in Visual Studio 2003. But now that I updated to VS2005, it no longer works. The Application.StartupPath apparently seems OK in the editor (no syntax errors and I'm able to select StartupPath from the Intellisense pop up...
4
6342
by: Rick | last post by:
I have a VB.Net 2005 application that I am publishing to a network file server. The app reads an xml file that has some database connection information in it. This xml file is located in the same folder as the executable. The problem is when I double click on the appname.application on the server the program can't find the xml file because the Application.StartupPath is: C:\Documents and Settings\UserName\Local Settings\Apps\2.0\...
0
1546
by: =?Utf-8?B?Sm9iIExvdA==?= | last post by:
I am using BulkLoad from .NET application as follows SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class obj = new SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class(); obj.ConnectionString = "Provider=SQLOLEDB;Server=serverName;Database=dbName;Integrated Security=SSPI"; obj.ErrorLogFile = Application.StartupPath + @"\Error.log"; obj.IgnoreDuplicateKeys = true;
3
9052
by: Joca | last post by:
I'm making a program that at some point needed to know what the path to it's own directory was, so i quickly made a side project just to test how this works ending up with the use of application.startuppath. Everything was working fine so i went back to the original project and tried to implement that solution, however, whenever i try to type that command i get an error message saying that Application is not declared. I didnt load any dll at...
0
9699
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
9562
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
10536
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10304
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
10285
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
10063
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...
0
9114
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...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.