By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,276 Members | 2,063 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,276 IT Pros & Developers. It's quick & easy.

SQLExpress database file auto-creation error

P: n/a
I am getting the beforementioned error when trying to populate DataSet
object with data taken from SQL2k database. Then I want to bind DataSet
to GridView control. But when I use SqlDataSource object to bind data
from the same database to the GridView everything is ok (using the same
connection string and SqlClient provider). And on top of that I don't
know why does this error refer to SQLExpress??? And it wants to create
an mdf file in App_Data...why?
Let me quote the whole error:

"SQLExpress database file auto-creation error:
The connection string specifies a local SQL Server Express instance
using a database location within the applications App_Data directory.
The provider attempted to automatically create the application services
database because the provider determined that the database does not
exist. The following configuration requirements are necessary to
successfully check for existence of the application services database
and automatically create the application services database:(...)"

And here's my connectionStrings section from web.config:

<add name="localConnectionString" connectionString="Data
Source=BOREK;Initial Catalog=electronic_driving_license_db;Integrated

And piece of code that is placed in separate class file located in

public class poCandidates
public DataSet dsCandidates;
public poCandidates()
dsCandidates = GetCandidatesAsTrainer();
private DataSet GetCandidatesAsTrainer()
string trainerID = HttpContext.Current.User.Identity.Name;
string strConnection =
SqlConnection myConnection = new SqlConnection(strConnection);
DataSet myDataSet = new DataSet();
SqlCommand myCommand;
SqlParameter myParameter;
myCommand = new SqlCommand("spGetCandidatesAsTrainer",
myCommand.CommandType = CommandType.StoredProcedure;
myParameter =
myCommand.Parameters.AddWithValue("@trainerID", SqlDbType.VarChar);
myParameter.Value = trainerID;
SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);


catch (Exception ex)


return myDataSet;
I am using Visual Web Developer 2005 Express Edition and ASP.NET 2.0.
I would appreciate any suggestions!

Piotr Boracki

Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Sorry it isn't working with SqlDataSource either. I wrote this because
I only managed to perform a test while using the wizard. the test went
ok. But it still isnt working. As a matter of a fact the debugger
doesn't even hit the file in which I have my code. It crashes before it
gets to the file. I'm really confused.

Piotr Boracki

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.