G
Gordon Padwick
I'm in the process of learning WPF and have been using NORTHWND.MDF while
becoming familiar with ADO.NET. All has worked well until a couple of days
ago. Now NORTHWND.MDF is no longer accessible, whereas PUBS.MDF works fine.
My simple code is:
class Program
{
static void Main(string[] args)
{
SqlConnection thisConnection = new SqlConnection(
@"Data Source=.\SQLEXPRESS;" +
@"AttachDbFilename='C:\SQL Server 2000 Sample
Databases\NORTHWND.MDF';" +
@"Integrated Security=True; Connect Timeout=30; User
Instance=True");
thisConnection.Open();
}
}
This code runs for a few seconds and then"DataReading has stopped working"
appears. After changing NORTHWND.MDF to PUBS.MDF in the code, all is fine.
I came to the conclusion that NORTHWND.MDF must be corrupt, so I decided to
delete it and then download a new version. When I tried to delete the file I
saw the message "The action can't be completed because the file is open in
another program. Close the file and try again."
I thought that maybe SQL Server Express had the file open, but I can't find
SQL Server Express on my computer.
Can anyone suggest how I can close the file when I don't know what program
has it open or whatever else I might try to get this simple code working
again?
Gordon
becoming familiar with ADO.NET. All has worked well until a couple of days
ago. Now NORTHWND.MDF is no longer accessible, whereas PUBS.MDF works fine.
My simple code is:
class Program
{
static void Main(string[] args)
{
SqlConnection thisConnection = new SqlConnection(
@"Data Source=.\SQLEXPRESS;" +
@"AttachDbFilename='C:\SQL Server 2000 Sample
Databases\NORTHWND.MDF';" +
@"Integrated Security=True; Connect Timeout=30; User
Instance=True");
thisConnection.Open();
}
}
This code runs for a few seconds and then"DataReading has stopped working"
appears. After changing NORTHWND.MDF to PUBS.MDF in the code, all is fine.
I came to the conclusion that NORTHWND.MDF must be corrupt, so I decided to
delete it and then download a new version. When I tried to delete the file I
saw the message "The action can't be completed because the file is open in
another program. Close the file and try again."
I thought that maybe SQL Server Express had the file open, but I can't find
SQL Server Express on my computer.
Can anyone suggest how I can close the file when I don't know what program
has it open or whatever else I might try to get this simple code working
again?
Gordon