SQLServer or Access?

R

Roy Gourgi

Hi,

I need to store and retrieve information from a database. It looks as though
there is a lot more support for SQLServer than there is for Access, correct
me if I am wrong.

What do I have to do to get SQLServer and which version should I be using.
Or is SQLServer already part of the VS.Net? Are there any good examples that
you know of.

TIA
Roy
 
R

Roy Gourgi

Hi Miha,

No, unfortunately I am just learning C# and eventually I am going to need to
store and retrieve a lot of information. My database will be very, very
large.
Which is faster by the way. SQLServer or Access. I would imagine SQLServer
is faster.

I am shocked at the plethora of tools available and the many different ways
of doing things. I am overwhelmed to tell you the truth.

I found a little code that allows me to display a database in Access on the
screen. How do I write to the database for example. Furthermore, is this
example a good way to retrieve information or are there more efficient
methods. There seem to be so many ways, it's hard to know where to start.

using System;
using System.Data.OleDb;

class OleDbTest

{

public static void Main()

{

//create the database connection

OleDbConnection aConnection = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=d:\\dbaccess\\db1.mdb");

//create the command object and store the sql query

// OleDbCommand aCommand = new OleDbCommand("select * from emp_test",
aConnection);

OleDbCommand aCommand = new OleDbCommand(


try

{

aConnection.Open();

//create the datareader object to connect to table

OleDbDataReader aReader = aCommand.ExecuteReader();

Console.WriteLine("This is the returned data from emp_test table");

//Iterate throuth the database

while(aReader.Read())

{

Console.Write(aReader.GetInt32(0).ToString());

Console.Write(" {0} {1} ",aReader.GetString(1),aReader.GetString(2));

Console.WriteLine();

// Console.WriteLine(" {0} ",aReader.GetString(2));

}

Console.ReadLine();

//close the reader

aReader.Close();

//close the connection Its important.

aConnection.Close();

}

//Some usual exception handling

catch(OleDbException e)

{

Console.WriteLine("Error: {0}", e.Errors[0].Message);

}

}

}

TIA
Roy








Miha Markic said:
Hi Roy,

I guess you need a small database.
Perhaps you might look at MSDE 2000 or MSDE 2005 which are scaled down
versions of Sql Server 2000/2005 and are free (when distributed with a
application produced with MS tool I think - not sure about licensing).

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Roy Gourgi said:
Hi,

I need to store and retrieve information from a database. It looks as
though there is a lot more support for SQLServer than there is for
Access, correct me if I am wrong.

What do I have to do to get SQLServer and which version should I be
using. Or is SQLServer already part of the VS.Net? Are there any good
examples that you know of.

TIA
Roy
 
R

Roy Gourgi

Sorry I copied the wrong example, here is the right one.

using System;

using System.Data.OleDb;

class OleDbTest

{

public static void Main()

{

//create the database connection

OleDbConnection aConnection = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=d:\\dbaccess\\db1.mdb");

//create the command object and store the sql query

OleDbCommand aCommand = new OleDbCommand("select * from emp_test",
aConnection);

// OleDbCommand aCommand = new OleDbCommand(


try

{

aConnection.Open();

//create the datareader object to connect to table

OleDbDataReader aReader = aCommand.ExecuteReader();

Console.WriteLine("This is the returned data from emp_test table");

//Iterate throuth the database

while(aReader.Read())

{

Console.Write(aReader.GetInt32(0).ToString());

Console.Write(" {0} {1} ",aReader.GetString(1),aReader.GetString(2));

Console.WriteLine();

// Console.WriteLine(" {0} ",aReader.GetString(2));

}

Console.ReadLine();

//close the reader

aReader.Close();

//close the connection Its important.

aConnection.Close();

}

//Some usual exception handling

catch(OleDbException e)

{

Console.WriteLine("Error: {0}", e.Errors[0].Message);

}

}

}
 
M

Miha Markic [MVP C#]

Hi Roy,

I guess you need a small database.
Perhaps you might look at MSDE 2000 or MSDE 2005 which are scaled down
versions of Sql Server 2000/2005 and are free (when distributed with a
application produced with MS tool I think - not sure about licensing).
 
L

lars_behrmann

Hi,

when you just start developing apps with database
access you could also make use of Firebird. Firebird
is an open source database and totally free of charge.
On Codeproject.com you'll find an example of using
Firebird. One big advantage is that it's just enough to deliver
the firebird dll within your apps, instead of installing
a new database on the user computer.

Embedded Firebird:
http://www.codeproject.com/cs/database/EmbeddedFirebird.asp

Cheers
Lars

Nothing is impossible. UML is the key for all your problems.
AODL - Make your .net apps OpenOffice ready
http://aodl.sourceforge.net/
 
M

Miha Markic [MVP C#]

Hi Roy,


--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Roy Gourgi said:
Hi Miha,

No, unfortunately I am just learning C# and eventually I am going to need
to store and retrieve a lot of information. My database will be very, very
large.
Which is faster by the way. SQLServer or Access. I would imagine SQLServer
is faster.

Sql server should be faster. But Ithen it depends on scenario - Access is
simplier (it isn't in the same category as Sql Server) thus it might do some
actions faster..
However, there are other database features that are more important, such as
reliability.
I am shocked at the plethora of tools available and the many different
ways of doing things. I am overwhelmed to tell you the truth.

I found a little code that allows me to display a database in Access on
the screen. How do I write to the database for example. Furthermore, is
this example a good way to retrieve information or are there more
efficient methods. There seem to be so many ways, it's hard to know where
to start.

You might start by reading help on ado.net topic.
It is a good starting point.
Other than that - a book perhaps?
 
M

Miha Markic [MVP C#]

Hi,

when you just start developing apps with database
access you could also make use of Firebird. Firebird
is an open source database and totally free of charge.
On Codeproject.com you'll find an example of using
Firebird. One big advantage is that it's just enough to deliver
the firebird dll within your apps, instead of installing
a new database on the user computer.

Yes, this is a deployment heaven :)
 
J

Jeff Louie

SLQS and Access address two distinct application domains with some
overlap.
MSDE is basically a connection crippled version of SQLS minus
administration
tools that is included free with VisualStudioPro. SLQS provides 24X7
live backup,
transactional support, and logging for disaster recovery. So if you are
writing an
application that can grow to hundreds of users across a WAN you may want
to
program to SQLS.

Regards,
Jeff
 
R

Roy Gourgi

Hi,

Thanks everybody for your input. I think that I will heed the advice with
regards to MSDE 2000 or 2005 because inevitably I will have to go with
SQLServer and since MSDE 2000 or 2005 is a watered down version, it will be
easier to make the transition.

Roy
 
B

Bjorn Abelli

Go for MSDE 2005 version. Its a scaled down version of SQL Server. When
you ever migrate to SQL Server you will be quiet comfortable , as
everything is almost the same. MSDE is far far better than Access as
one is a RDBMS and other DBMS.

I wouldn't say that Access is a DBMS at all.

Access is "just" a front-end application to administrate, manage and
manipulate the data in a database, which can be an RDBMS or other. You can
use against Oracle, SQL Server, or whatever database that you can find an
ODBC-driver for.

Many people seem to confuse Access with its default databaseengine Jet,
which actually *is* an RDBMS.

Apart from that I agree with you that the OP should try MSDE as its scales
nicely to the full SQL Server.


// Bjorn A
 
B

Bjorn Abelli

Hi Bijorn
If i am not mistaken access also stores data --- so said from that
perspective.

Not from the database perspective.

It can store forms, etc, inside the same file (mdb) as the Jet-engine stores
the data for the database.

But that still doesn't make Access more of a DBMS than MS Word, which also
stores data...

// Bjorn A
 
K

Kevin Spencer

Hi Roy,

Don't pay attention to what seems to have "the most" support in the .Net
CLR. Look at your requirements. The Framework has plenty of capability for
handling any kind of database.

In your case, you say that your application will eventually need to store
and retrieve a lot of data. You didn't say, but it could be presumed by the
scale, that it will also have to handle a lot of traffic, and possibly over
a network. In that case, you're talking about a large-scale database server,
not a medium-scale file-base database. So, SQL Server is the way to go.

Now, if you're worried about designing your SQL Server database, well, you
should be. First of all, you have to think about the amount of data it will
hold, and how to most efficiently store it, and maintain it. SQL Server is
well-equipped with plenty of functionality for everything you can imagine.
So, I would suggest that what you know about databases from working with
Access will be inadequate at some near point in the future. You might
consider contracting the database design out, hiring a DBA, or whatever fits
your budget.

In the meantime, there's no reason why you can't get started. Fortunately,
Access can integrate with SQL Server quite well, and you can work with a SQL
Server database via Access, and use the familiar Access interface to create
your database tables, stored procedures, etc. Just read the Access help on
SQL Server database projects.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

Roy Gourgi said:
Hi Miha,

No, unfortunately I am just learning C# and eventually I am going to need
to store and retrieve a lot of information. My database will be very, very
large.
Which is faster by the way. SQLServer or Access. I would imagine SQLServer
is faster.

I am shocked at the plethora of tools available and the many different
ways of doing things. I am overwhelmed to tell you the truth.

I found a little code that allows me to display a database in Access on
the screen. How do I write to the database for example. Furthermore, is
this example a good way to retrieve information or are there more
efficient methods. There seem to be so many ways, it's hard to know where
to start.

using System;
using System.Data.OleDb;

class OleDbTest

{

public static void Main()

{

//create the database connection

OleDbConnection aConnection = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=d:\\dbaccess\\db1.mdb");

//create the command object and store the sql query

// OleDbCommand aCommand = new OleDbCommand("select * from emp_test",
aConnection);

OleDbCommand aCommand = new OleDbCommand(


try

{

aConnection.Open();

//create the datareader object to connect to table

OleDbDataReader aReader = aCommand.ExecuteReader();

Console.WriteLine("This is the returned data from emp_test table");

//Iterate throuth the database

while(aReader.Read())

{

Console.Write(aReader.GetInt32(0).ToString());

Console.Write(" {0} {1} ",aReader.GetString(1),aReader.GetString(2));

Console.WriteLine();

// Console.WriteLine(" {0} ",aReader.GetString(2));

}

Console.ReadLine();

//close the reader

aReader.Close();

//close the connection Its important.

aConnection.Close();

}

//Some usual exception handling

catch(OleDbException e)

{

Console.WriteLine("Error: {0}", e.Errors[0].Message);

}

}

}

TIA
Roy








Miha Markic said:
Hi Roy,

I guess you need a small database.
Perhaps you might look at MSDE 2000 or MSDE 2005 which are scaled down
versions of Sql Server 2000/2005 and are free (when distributed with a
application produced with MS tool I think - not sure about licensing).

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Roy Gourgi said:
Hi,

I need to store and retrieve information from a database. It looks as
though there is a lot more support for SQLServer than there is for
Access, correct me if I am wrong.

What do I have to do to get SQLServer and which version should I be
using. Or is SQLServer already part of the VS.Net? Are there any good
examples that you know of.

TIA
Roy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top