473,386 Members | 1,705 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,386 software developers and data experts.

applications allways looking on c:/ regardless of connection string

133 100+
for some reason my application is looking for my database in the wrong place
i get an error "cannot find C:/database.accdb"


Expand|Select|Wrap|Line Numbers
  1.   Dim conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\database.accdb")
  2.         Dim cmd As New OleDbCommand("SELECT COUNT(*) FROM [users] WHERE Fname = @Fname AND Lname = @Lname AND Password = @Password", conn)
this is in my app.config aswell
Expand|Select|Wrap|Line Numbers
  1.  connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\database.accdb"
  2.             providerName="System.Data.OleDb" />
i have searched the whole solution from "C:/database.accdb" but it is nowhere any ideas?
Jan 7 '10 #1
4 1588
tlhintoq
3,525 Expert 2GB
Its on your F: drive
Jan 7 '10 #2
tlhintoq
3,525 Expert 2GB
Sorry... just being funny.

i have searched the whole solution for "C:/database.accdb" but it is nowhere any ideas?
Data Source=\database.accdb
It's right here. I'm pretty sure that this causes it to look on the same drive as the running application, which in your case is C:

I suggest you read through these tutorials:
Database How to parts 1 and 2
http://bytes.com/topic/net/insights/...e-your-program
http://bytes.com/topic/net/insights/...rogram-part-ii
Jan 7 '10 #3
gobblegob
133 100+
i got it now changed this
Expand|Select|Wrap|Line Numbers
  1. Dim conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\database.accdb")
to,,,
Expand|Select|Wrap|Line Numbers
  1. Dim conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\database.accdb")
Jan 7 '10 #4
Plater
7,872 Expert 4TB
All you needed was a fully qualified path
Jan 8 '10 #5

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

Similar topics

2
by: Michael Williams | last post by:
Hi, I am trying to create a VB6 application which can act as a 'connection broker' for other applications being run on the same machine. Essentially, the broker app will setup a number of...
3
by: Craig | last post by:
I've developed an single sign on web application that we'd like to use with all the applications we're developing. The application's connection string is stored in web.config. I've gotten some...
6
by: Terry Bell | last post by:
We've had a very large A97 app running fine for the last seven years. I've just converted to SQL Server backend, which is being tested, but meanwhile the JET based version, running under terminal...
3
by: Josema | last post by:
Hi, I have a web application, that takes from excel a range of rows and columns... The method that gets the data in the ranges returns an Array of two dimensions with the data... Then i...
1
by: Shapper | last post by:
Hello, I am reading the <item> nodes from a XML file and add them to a dataset. When I display my dataset in a datagrid I always see the same record. It's like the For loop is not moving from...
43
by: Rob R. Ainscough | last post by:
I realize I'm learning web development and there is a STEEP learning curve, but so far I've had to learn: HTML XML JavaScript ASP.NET using VB.NET ..NET Framework ADO.NET SSL
19
by: VB Programmer | last post by:
If I have a VB6 and a VB.NET application, or 2 VB.NET applications what is the best way to "talk" between them? They both run on the same PC. Right now I'm just using text files to share...
26
by: gabry.morelli | last post by:
Is it possible to create an .ADP application (in Access 2003) without having to connect SQL Server but using directly the tables and queries inside the .ADP file? Thanks
2
by: dev | last post by:
Several years ago I developed an Access 97 runtime application. I have rewritten this application using Visual Basic 6 with an Access 2003 database. When I run the VB application with 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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:
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...
0
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,...
0
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...

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.