Need a very small (one table) database!!!
Need a very small (one table) database!!!
am 02.04.2008 22:56:09 von Steve Kershaw
Hi,
I'm working on a project that requires a small database. I'm thinking
an .MDF database.
However, I'm having a problem with connecting to the database. The
code I have is:
string strConnection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Inetpub\wwwroot\Use Tax\App_Data\AddressBook.mdf";
OleDbConnection objConnection = new
OleDbConnection(strConnection);
objConnection.Open();
OleDbDataAdapter adapter = new OleDbDataAdapter("select FName,
LName from Address", objConnection);
DataSet ds = new DataSet();
adapter.Fill(ds, "Address");
I get an 'Unrecognized database format 'C:\Inetpub\wwwroot\Use Tax
\App_Data\AddressBook.mdf' OleDbExcption when I run it.
Any ideas?
Thanks in advance.
Re: Need a very small (one table) database!!!
am 02.04.2008 23:03:21 von Patrice
If you only need one table and no relational model you should reconsider the
use of an XML file.
"S_K" wrote in message
news:7d1d4171-5fcb-49bd-a4c2-1dfaa9a9cef2@q27g2000prf.google groups.com...
> Hi,
>
> I'm working on a project that requires a small database. I'm thinking
> an .MDF database.
> However, I'm having a problem with connecting to the database. The
> code I have is:
>
> string strConnection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
> Source=C:\Inetpub\wwwroot\Use Tax\App_Data\AddressBook.mdf";
>
> OleDbConnection objConnection = new
> OleDbConnection(strConnection);
> objConnection.Open();
>
> OleDbDataAdapter adapter = new OleDbDataAdapter("select FName,
> LName from Address", objConnection);
> DataSet ds = new DataSet();
>
> adapter.Fill(ds, "Address");
>
> I get an 'Unrecognized database format 'C:\Inetpub\wwwroot\Use Tax
> \App_Data\AddressBook.mdf' OleDbExcption when I run it.
> Any ideas?
>
> Thanks in advance.
Re: Need a very small (one table) database!!!
am 02.04.2008 23:06:11 von Patrice
Forgot to mention you're using the wrong provider. The .mdf file created
with SQL Express requires the SQL provider.
"S_K" wrote in message
news:7d1d4171-5fcb-49bd-a4c2-1dfaa9a9cef2@q27g2000prf.google groups.com...
> Hi,
>
> I'm working on a project that requires a small database. I'm thinking
> an .MDF database.
> However, I'm having a problem with connecting to the database. The
> code I have is:
>
> string strConnection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
> Source=C:\Inetpub\wwwroot\Use Tax\App_Data\AddressBook.mdf";
>
> OleDbConnection objConnection = new
> OleDbConnection(strConnection);
> objConnection.Open();
>
> OleDbDataAdapter adapter = new OleDbDataAdapter("select FName,
> LName from Address", objConnection);
> DataSet ds = new DataSet();
>
> adapter.Fill(ds, "Address");
>
> I get an 'Unrecognized database format 'C:\Inetpub\wwwroot\Use Tax
> \App_Data\AddressBook.mdf' OleDbExcption when I run it.
> Any ideas?
>
> Thanks in advance.
Re: Need a very small (one table) database!!!
am 02.04.2008 23:24:51 von Norman Yuan
*.mdf is data file used by SQL Server/Express. It is soly accessed by SQL
Server, you cannot directly access it with your code. Yoou must have SQL
Server/Express installed in order to make *.mdf file useful.
You can use Jet database (*.mdb) file, which is file base database, without
need to have MS Access installed. YOu can also look into SQL Server CE, also
file based database and very small footprint. Yes, SQL Server CE is mainly
for mobile device (hence, small fot print) and can also be used for desktop
application.
"S_K" wrote in message
news:7d1d4171-5fcb-49bd-a4c2-1dfaa9a9cef2@q27g2000prf.google groups.com...
> Hi,
>
> I'm working on a project that requires a small database. I'm thinking
> an .MDF database.
> However, I'm having a problem with connecting to the database. The
> code I have is:
>
> string strConnection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
> Source=C:\Inetpub\wwwroot\Use Tax\App_Data\AddressBook.mdf";
>
> OleDbConnection objConnection = new
> OleDbConnection(strConnection);
> objConnection.Open();
>
> OleDbDataAdapter adapter = new OleDbDataAdapter("select FName,
> LName from Address", objConnection);
> DataSet ds = new DataSet();
>
> adapter.Fill(ds, "Address");
>
> I get an 'Unrecognized database format 'C:\Inetpub\wwwroot\Use Tax
> \App_Data\AddressBook.mdf' OleDbExcption when I run it.
> Any ideas?
>
> Thanks in advance.
Re: Need a very small (one table) database!!!
am 03.04.2008 00:33:14 von mark
"S_K" wrote in message
news:7d1d4171-5fcb-49bd-a4c2-1dfaa9a9cef2@q27g2000prf.google groups.com...
> I get an 'Unrecognized database format 'C:\Inetpub\wwwroot\Use Tax
> \App_Data\AddressBook.mdf' OleDbExcption when I run it.
Yes, you would...
> Any ideas?
You're trying to connect to a SQL Server Express database with the Jet OleDb
driver... Decide whether you want to use SQL Server Express or Jet, and then
choose the correct connection string...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
RE: Need a very small (one table) database!!!
am 03.04.2008 03:42:00 von pbromberg
Consider using either a SQL Server Compact 3.5 file-based database file, or
another similar file-based embedded database file such as SQLite with the
ADO.NET SQLite 2.0 provider.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net
"S_K" wrote:
> Hi,
>
> I'm working on a project that requires a small database. I'm thinking
> an .MDF database.
> However, I'm having a problem with connecting to the database. The
> code I have is:
>
> string strConnection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
> Source=C:\Inetpub\wwwroot\Use Tax\App_Data\AddressBook.mdf";
>
> OleDbConnection objConnection = new
> OleDbConnection(strConnection);
> objConnection.Open();
>
> OleDbDataAdapter adapter = new OleDbDataAdapter("select FName,
> LName from Address", objConnection);
> DataSet ds = new DataSet();
>
> adapter.Fill(ds, "Address");
>
> I get an 'Unrecognized database format 'C:\Inetpub\wwwroot\Use Tax
> \App_Data\AddressBook.mdf' OleDbExcption when I run it.
> Any ideas?
>
> Thanks in advance.
>
Re: Need a very small (one table) database!!!
am 03.04.2008 14:26:19 von Brian Campbell
I've had great success simply using an XML file like:
campbellbrian2001@yahoo.com
Brian Campbell
tazmania
robinsoncheryl@hotmail.com
Cheryl Robinson
ceylon
I connect and read the XML file to add users, passwords, and email
addresses like:
Then to login I use this:
Hope this sparks some ideas. When I need a quick small database I use
XML files.
On Apr 2, 4:56=A0pm, S_K wrote:
> Hi,
>
> I'm working on a project that requires a small database. I'm thinking
> an .MDF database.
> However, I'm having a problem with connecting to the database. The
> code I have is:
>
> string strConnection =3D @"Provider=3DMicrosoft.Jet.OLEDB.4.0;Data
> Source=3DC:\Inetpub\wwwroot\Use Tax\App_Data\AddressBook.mdf";
>
> =A0 =A0 OleDbConnection objConnection =3D new
> OleDbConnection(strConnection);
> =A0 =A0 objConnection.Open();
>
> =A0 =A0 OleDbDataAdapter adapter =3D new OleDbDataAdapter("select FName,
> LName from Address", objConnection);
> =A0 =A0 DataSet ds =3D new DataSet();
>
> =A0 =A0 adapter.Fill(ds, "Address");
>
> I get an 'Unrecognized database format 'C:\Inetpub\wwwroot\Use Tax
> \App_Data\AddressBook.mdf' OleDbExcption when I run it.
> Any ideas?
>
> Thanks in advance.