PC Review


Reply
Thread Tools Rate Thread

Connecting to Northwind via path

 
 
CES
Guest
Posts: n/a
 
      21st Feb 2009

All,
I've been able to get my Entity Data Model to work but I'm having problems
with a normal ADO Connection. I'm really new to all of this and I can't seem
to find a way to connect to Nortwind via a direct path ie:
C:\Temp\NORTHWND.MDF within a console app.

The MSDN Article http://msdn.microsoft.com/en-us/library/dw70f090.aspx shows
everything except using a direct path. If anyone knows of A SIMPLE example
of a complete database call (in C#) I would be grateful.

 
Reply With Quote
 
 
 
 
Norman Yuan
Guest
Posts: n/a
 
      21st Feb 2009
The code in your quoted link is based on the fact that there is a local
default SQL Server instance, which has a database called "Nothwind", hence
the code like this:

Dim connectionString As String = _
"Data Source=(local);Initial Catalog=Northwind;" _
& "Integrated Security=true"

It looks like you need to know a bit more on SQL Server (most .NET code
samples assume the developer know the very basic SQL Server thing when the
samples deal with data from SQL Server). You do not directly connect/access
to *.mdf file. This file is exclusively used by SQL Server. The only time
you need to deal it directly is when you need to attach the *.mdf file to
SQL Server so that a database based on this *.mdf file is created with the
SQL Server. Then you connect to this database to access data. Once the *.mdf
file is attached to SQL Server, nothing can access it except for SQL Server.

If you find some sample code that has "AttachDBFile=... " and "USER
INSTANCE=true", try to avoid it until you really know what "USER INSTANCE"
means (study on SQL Server BOL).

"CES" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>
> All,
> I've been able to get my Entity Data Model to work but I'm having problems
> with a normal ADO Connection. I'm really new to all of this and I can't
> seem to find a way to connect to Nortwind via a direct path ie:
> C:\Temp\NORTHWND.MDF within a console app.
>
> The MSDN Article http://msdn.microsoft.com/en-us/library/dw70f090.aspx
> shows everything except using a direct path. If anyone knows of A SIMPLE
> example of a complete database call (in C#) I would be grateful.


 
Reply With Quote
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      21st Feb 2009
Hi,

I assume you are busy with a non express version of sql server 2008, replace
then local for the machinename of the computer.

Otherwise have a look at this website

http://www.connectionstrings.com/

The given samples looks fine to me

Cor


"CES" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>
> All,
> I've been able to get my Entity Data Model to work but I'm having problems
> with a normal ADO Connection. I'm really new to all of this and I can't
> seem to find a way to connect to Nortwind via a direct path ie:
> C:\Temp\NORTHWND.MDF within a console app.
>
> The MSDN Article http://msdn.microsoft.com/en-us/library/dw70f090.aspx
> shows everything except using a direct path. If anyone knows of A SIMPLE
> example of a complete database call (in C#) I would be grateful.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help connecting to northwind database Microsoft VB .NET 1 28th May 2006 10:31 PM
Changing DataViewManager.RowFilter has no effect - Sample Northwind Code Attached - Northwind.zip (0/1) Jay Pondy Microsoft Dot NET Framework Forms 0 12th Feb 2005 12:24 PM
Re: connecting to a XP machine via unc path JW Windows XP Security 0 25th Jun 2004 08:25 PM
Connecting to a UNC path Ketta Microsoft Windows 2000 Security 0 26th May 2004 03:15 PM
Argument out of Range Exception -- Connecting to Northwind.mdb =?Utf-8?B?UGF1bCBOZXZldQ==?= Microsoft C# .NET 1 9th Mar 2004 03:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:49 PM.