mdf Files?

S

stuart.d.jones

Hi,

I'm trying to write an application which will eventually use SQL
Express running on a server, with a client app running on several
client machines. I'm developing it with an instance of SQL Express
running on my local machine, however.

I want to use the built-in data functionality of VB.NET 2005, but how
do I set this up to work in VB.NET Express 2005 for future deployment -
or can't I? If I can't, is VB the limitation, or SQL Express?

At the minute I've pointed VB.NET to the .mdf file on the local machine
I'm developing on, but how can I deploy the app - I can't copy the .mdf
file to every client machine, I only want one copy to reside on the
database server (obviously).

Help!!!

Thanks in advance,

Stu
 
A

AMDRIT

Stu,

You are missing some fundamentals and some basic steps. I am not trying to
belittle you, but you have to know where are starting from.


There are many articles out there to help you on your way. I will attempt
to explain the just of it, and ask you to ask "Why" and "How" on google and
on the forums.

SQL Express, a variant of SQL Server is a windows service that allows
multiple connections to simultaneously interact with the data. A SQL
Environment may consist of multiple databases, each database is a virtual
representation of a least 2 files (MDF, LDF)

An MDF file is the primary data storage file
An LDF file is the primary transaction log file.
Additionally, you may specify additional files (For various reasons, none
that you would initially need) and they are named NDF files.

Each of these files are intended to be used solely by the SQL environment,
in fact, when SQL server is up and running, you cannot access the files.

Microsoft has enabled SQL with the uncanny ability to accept connections
from applications you write in the for of data providers. In your case, you
would most likely want to use ADO.Net 2.0 (this comes with VS 2005). More
specifically, you will want the SQLClient data provider.

I am not aware of your prowess in and around Visual Studio, and therefore
cannot assume mature. The development environment is comprised of a few
aspects. The framework, the CLR, the desired language, and a compiler.

The framework is a set of work and assemblies already completed for your
use, this allows you to avoid recreating the wheel on common, mundane, and
sometimes complex coding efforts. As an example, the framework includes
ADO.Net 2.0. This assembly knows everything that there is about one
specific task (Connecting you to your database and allowing you to interact
with the data.)

The CLR is the common runtime language, this component allows developers
from all walks of life to use the language (or a dialect thereof) of their
choice. The CLR understands the languages, and can act as the mediator
between assemblies of different languages. So that a DLL written in VB can
be called upon by C++ and C# without any special effort. The runtime is
also the piece that lights the fire under the hood of your program giving it
life when your users wish to use your application.

The environment natively supports VB, C++, and C# (I think it was created
with C# in mind). It also supports a myriad of other languages and I will
not begin to attempt to list them here.

I have provided a link that has additional reading on the subject and also a
link to sample applications.

http://msdn.microsoft.com/vbasic/downloads/code/101samples/

Now, if you have gotten this far, I appreciate your patience and
understanding. To get more specific with your question, "How do I create a
database on a 'server' machine and then connect to that database from my
client application?"

Setup SQL and Database
1. Install SQL Express on the designated machine that will act as the
server.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/sseoverview.asp

Setup Visual Studio
1. Install Visual Studio
1.a watch some of these webcasts from MS professionals
http://www.microsoft.com/events/webcasts/ondemand.mspx It will only cost
you time.
2. Launch Visual Studio
3. Download and Install Visual Basic Samples
(http://www.microsoft.com/downloads/...crosoft.com/vbasic/downloads/code/101samples/)

Review the samples in the "Data" section.


I truly hope this helps.
 
S

stuart.d.jones

Thanks for your help.

I sorted out the problem - a glitch in VB.NET 2005 Express was only
letting me create a connection string via selecting an .mdf file. I
managed to work round this and can now specify remote connection
strings no problem.
 

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