473,395 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

simple question/correction

284 100+
i am using the following code for opening the connection

Expand|Select|Wrap|Line Numbers
  1. con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\graph\Sales.mdb;Persist Security Info=False"
it work fine but only when i place a database on D:\graph\Sales.mdb
i want that it should work even i install my project on any directory or in any folder.

i know there is somting i had to use APP PATH\sales.mdb insted of D:\graph\Sales.mdb which can solve this but i just forget
it and not getting the correct code
Feb 20 '08 #1
4 860
jamesd0142
469 256MB
i am using the following code for opening the connection

Expand|Select|Wrap|Line Numbers
  1. con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\graph\Sales.mdb;Persist Security Info=False"
it work fine but only when i place a database on D:\graph\Sales.mdb
i want that it should work even i install my project on any directory or in any folder.

i know there is somting i had to use APP PATH\sales.mdb insted of D:\graph\Sales.mdb which can solve this but i just forget
it and not getting the correct code
application.startuppath & "\databasename"
Feb 20 '08 #2
mafaisal
142 100+
Hi,

Try This


in Vb6

Expand|Select|Wrap|Line Numbers
  1. dim DataPath as string
  2. DataPah = app.path & "\Sales.mdb"
  3. con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & DataPath & ";Persist Security Info=False"
  4.  
  5.  
In .net2005


Expand|Select|Wrap|Line Numbers
  1.  
  2. dim DataPath as string = System.Environment.CurrentDirectory & "\Sales.mdb"
  3.  
Faisal
Feb 20 '08 #3
muddasirmunir
284 100+
Thanks .

Hi,

Try This


in Vb6

Expand|Select|Wrap|Line Numbers
  1. dim DataPath as string
  2. DataPah = app.path & "\Sales.mdb"
  3. con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & DataPath & ";Persist Security Info=False"
  4.  
  5.  
In .net2005


Expand|Select|Wrap|Line Numbers
  1.  
  2. dim DataPath as string = System.Environment.CurrentDirectory & "\Sales.mdb"
  3.  
Faisal
Feb 20 '08 #4
mafaisal
142 100+
Hello,

Always welcome

Faisal

Thanks
Feb 20 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

65
by: perseus | last post by:
I think that everyone who told me that my question is irrelevant, in particular Mr. David White, is being absolutely ridiculous. Obviously, most of you up here behave like the owners of the C++...
16
by: Terry | last post by:
Hi, This is a newbie's question. I want to preload 4 images and only when all 4 images has been loaded into browser's cache, I want to start a slideshow() function. If images are not completed...
7
by: Tom wilson | last post by:
I have created a very simple example that doesn't work. Form1 contains a textbox and a button: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles...
1
by: Geoff Pennington | last post by:
I've never done any graphics before and am experimenting. I tried to draw a circle using the graphics.DrawEllipse() method, something like this: DrawEllipse(myPen, 0,0,300,300). However, the...
10
by: leaf | last post by:
How do i make a simple parser that parse strings ex. "string1 string2 string3" and store in a vector? how can it be done using BOOST.Spirit? --- leaf
5
by: pauldepstein | last post by:
On page 82 of Effective C++, an example of non-compilable code is given as follows: std::tr1::shared_ptr<Investment> pInv(0, getRidOfInvestment); I understand this part -- 0 is not a valid...
18
by: Steven | last post by:
Hi I'm new to js so this prob is a simple question but I haven't been able to solve it. I have 2 text fields which let me pick a graphic file and want to display then in 2 image place holders so...
13
by: aum | last post by:
Hi, I'm a Python programmer, just starting to get into javascript. On reading some of the js guides, and not liking any of the OO usage patterns I saw, I've cooked up something which python...
9
by: fishmonger1972 | last post by:
I'm a librarian trying to put a finishing touch on an online materials catalog. The line below seems to do nothing in my program.. And I don't get any error messages. So, I'm very perplexed...
0
by: kimiraikkonen | last post by:
Hi, I'm using Visual C# .NET 2005, i have 2 forms when a button in form1 is clicked, second form must be shown, and second form (form2) has webbrowser control associated to run on load time. the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.