473,398 Members | 2,113 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,398 software developers and data experts.

Data in a local file

How would I have a SqlConnection object point to a local file as a
database, for example a file named tables.db that's in the same folder
as the program output directory?
Jun 1 '06 #1
8 1416
You would not do this with a SqlConnection.you could however do this quite
easily with an embeded databse like Sqlite http://www.sqlite.org/. You can
download the managed provider here http://adodotnetsqlite.sourceforge.net/.

Peter also has an article on it
http://www.eggheadcafe.com/articles/20040714.asp and another on the
SqlLiteHelper class which should get you going
http://www.eggheadcafe.com/articles/20050315.asp

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
You could however do this quite easily
"David P. Donahue" <dd******@ccs.neu.edu> wrote in message
news:uB**************@TK2MSFTNGP02.phx.gbl...
How would I have a SqlConnection object point to a local file as a
database, for example a file named tables.db that's in the same folder as
the program output directory?

Jun 1 '06 #2
David,

The clases in the System.Data.SqlClient namespace are meant specifically
for connecting to Sql Server or Sql Server express. You can't just connect
to an arbitrary file.

What is the format of the data in the file? If it is for another
database provider, then you should be able to get a data provider from them
which sticks to the .NET model for data providers.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"David P. Donahue" <dd******@ccs.neu.edu> wrote in message
news:uB**************@TK2MSFTNGP02.phx.gbl...
How would I have a SqlConnection object point to a local file as a
database, for example a file named tables.db that's in the same folder as
the program output directory?

Jun 1 '06 #3
> What is the format of the data in the file? If it is for another
database provider, then you should be able to get a data provider from them
which sticks to the .NET model for data providers.


Not sure what specific format it's in. It was converted from a dbase
file, if that helps. Is there a way to find out what format it is?
Jun 1 '06 #4
Hello David,

For .db ext it could be several type of dbs, like foxpro, dbase and etc
I recomend to use either ODBC for this or library for native access, like
CodeBase (it works with seral types of .DB bases)
What is the format of the data in the file? If it is for another
database provider, then you should be able to get a data provider
from them which sticks to the .NET model for data providers.

DD> Not sure what specific format it's in. It was converted from a
DD> dbase file, if that helps. Is there a way to find out what format
DD> it is?
DD>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Jun 1 '06 #5
David,

Well, if it is a dbase file, then you could find a dbase ODBC driver and
then use the classes in the System.Data.Odbc namespace. The thing is, if it
was converted, then what was it converted to?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"David P. Donahue" <dd******@ccs.neu.edu> wrote in message
news:44************@ccs.neu.edu...
What is the format of the data in the file? If it is for another
database provider, then you should be able to get a data provider from
them which sticks to the .NET model for data providers.


Not sure what specific format it's in. It was converted from a dbase
file, if that helps. Is there a way to find out what format it is?

Jun 1 '06 #6
> Well, if it is a dbase file, then you could find a dbase ODBC driver and
then use the classes in the System.Data.Odbc namespace. The thing is, if it
was converted, then what was it converted to?


The most I could get from the developer who sent it to me is that it's a
Paradox file. Not something I've worked with (the only local-file
databases I've ever seen were MS Access) so I really don't know much
about that.

I can add it to my ODBC User DSN just fine, but it's been years since
I've used that. What would the connection string be for an
OdbcConnection object be then?
Jun 1 '06 #7
Wait, I think www.connectionstring.net has what I'm looking for (damn
this looks like a useful site, I wish I'd found it months ago). :)
Jun 1 '06 #8
David P. Donahue wrote:
Wait, I think www.connectionstring.net has what I'm looking for (damn
this looks like a useful site, I wish I'd found it months ago). :)


I think you mean http://www.connectionstrings.com/

Jim
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
You roll an 18 in Dex and see if you
don't end up with a girlfriend
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
JimD
Central FL, USA, Earth, Sol
Jun 3 '06 #9

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

Similar topics

0
by: Donald Tyler | last post by:
Then the only way you can do it that I can think of is to write a PHP script to do basically what PHPMyAdmin is trying to do but without the LOCAL in there. However to do that you would need to...
0
by: JohnLH | last post by:
Hi, I am having an issue with the LOAD DATA LOCAL FILE command on the latest 3.0.9 JDBC Driver. The command works on Windows, but doesn't seem to work on OSX and Linux. The error that I get on...
1
by: Ray in HK | last post by:
What are the differences between LOAD DATA INFILE and LOAD DATA LOCAL INFILE ? I found some web hosting company do not allow using LOAD DATA INFILE but allow LOAD DATA LOCAL INFILE. The reason...
5
by: rogsonl | last post by:
My computer was moved last week, and the company changed the network groups we work on. As a result, one of the main benefits from Whidbey (database connectivity) no longer works. Situation: 1....
10
by: _(d)IEGO | last post by:
Hello everyone. I need help regarding the following: Given the following table: CREATE TABLE T1 (C1 nvarchar(10), C2 money) INSERT INTO T1 VALUES ('A',1) INSERT INTO T1 VALUES ('B',2) INSERT...
3
by: asemeiks | last post by:
I'm using Access 97, Jet 4.0. the data resides on a Win 2000 domain server. Using .Net 1.1 and IIS 5.0 on a local XPPro computer I am trying connect to a Jet database on the server. If the data...
9
by: David Harris | last post by:
Ok, so I'm semi-new to .NET, having done everything manually with SQL code back in VB6. So before I program this up completely manually again, I thought I'd ask for better ways to think through...
2
by: Cameron Walsh | last post by:
Hi all, I'm trying to extract the data from a bitmap or .pnm file using the following code: import Image img = Image.open("test.bmp","r") data=img.getdata() Unfortunately I get the...
0
ADezii
by: ADezii | last post by:
Rather than using CurrentProject.Connection or entering your own Connection information, ADO supports storing Connection information in an external file called a Data Link File (which normally has a...
5
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have a app that uses several membership/role providers. I can list these Providers with the code: Dim rootWebConfig1 As Configuration rootWebConfig1 =...
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: 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: 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
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
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
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,...

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.