Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 29th, 2007, 11:17 PM
Authorized User
 
Join Date: Apr 2007
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default I don't want VWD to generate mdf files, how?

I have the following problem. Visual Web Developer and Visual Web Developer Express both generate mdf files (under App_Data) when you, for example, add certain controls. This is a problem because my third party hosting server does not allow mdf/ldf files. Further, even though you can create SQL databases on these servers their tools do not allow mdf data to be imported into to the SQL data bases (only cvs or .sql).

I cannot upload my own database either, so I need to change the connection string in web.config in any case. That is not the problem. The problem is that any mdf/ldf file is totally useless, because no available tools can read or import data from them.

If you are curious, this company is called godaddy.com and their servers are ASP.NET 2.0 enabled (just no mdf files).

Question>>
So is it possible to have Visual Web Devloper generate something else then mdf/ldf files like an .sql file, .cvs file or script. Is there a configuration setting perhaps? That would be neat.

If it is not possible to stop VWD from automatically generating mdf/ldf. What would be the best way of converting these into cvs files? Or .sql files?

Also if someone knows a third party hosting company that allows mdf/ldf files I am open for suggestions.

 
Old April 30th, 2007, 03:53 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Thomas,

Take a look here: http://weblogs.asp.net/scottgu/archi...25/423703.aspx

It explains how to override the settings for the providers like Membership and Roles so they use an existing database instead of creating a new one in the App_Data folder.

Then you may want to read this: http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=395 to learn how to configure SQL Server and your ASP.NET web app to work with this remote database.

HtH,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old April 30th, 2007, 05:19 PM
Authorized User
 
Join Date: Apr 2007
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much Imar, that was exactly what I needed!:D

 
Old May 1st, 2007, 01:37 AM
Authorized User
 
Join Date: Apr 2007
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well I think this is what I need, I am not totally sure anymore because I ran into problems. Even though I can launch the aspnet_regsql wizard I cannot do step 1 before, creating an empty data base. I am launching SQL Server Configuration Manager (is there something else?) and it has no menu items for creating Data Bases, and the help search string "Create Database" comes with nothing, and search string "Create" yields information that does not show anything in regards to databases. So I don't know how to create an empty database. Sorry I am new at this.

I assume once I succeed with following Scott Guthries instruction the controls I add (like login control) will automatically store the information in the new sql database rather than the mdf file. Is that correct?

 
Old May 1st, 2007, 02:30 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
quote:Originally posted by ThomasWikman
Further, even though you can create SQL databases on these servers
I don't know how they configured things, but I don't think you can create new databases with your client tools.

BTW: the Configuration Manager is just for configuration; you can't use it to create new databases. You'll need the SQL Server Management Studio for that, that comes with SQL Server commercial editions. You can also get a free version called SQL Server Management Studio Express edition that you can download from the Microsoft site.

However, I think that won't work either. I think you'll need to create a new database on-line with the tools your host provides.

Then point your local aspnet_regsql tool to the online database and configure the database you created there.

Finally, you need to reconfigure your web.config file so it uses your own database instead of the local SQL Server Express that is used by default.

Sorry I can't give you more detailed steps; each host uses a different procedure so you'll need to check with them.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old May 1st, 2007, 04:11 PM
Authorized User
 
Join Date: Apr 2007
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your help. However, I need to solve this locally on my machine since I don't have direct access to the server. I need one of two things:

(1) Stop Visual Web Developer from making mdf/ldf files and instead make .sql or CSV files that I am allowed to upload and import from.

or

(2) Convert the mdf/ldf file to .sql or CSV locally on my machine.

I already created an empty data base on the server using a web tool they provide. I am partially allowed to configure it, but I cannot do the things you can do with aspnet_regsql. I also wrote a connection string that allows me to connect to it (I can successfully connect to the empty database). What is missing is the data which I unfortunately have in a useless mdf/ldf file.

Now I need to import this data into the empty database which I am allowed to do as long as it is in sql or CSV format. So first I need to convert the mdf/ldf data to sql or CSV format locally on my machine.

Since I don't have SQL Server Management Studio and I do not have direct access to the server either, nor the database, it turns out that the two articles do not apply to my case. I did not realize this until now.

I think my problem must be quite common and still there seem to be very little information on how to solve it, so I really appreciate you trying to help with this.

Again thanks a lot for helping me.

 
Old May 1st, 2007, 04:23 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

VWD doesn't create these databases, but the ASP.NET run-time does. While this may seem unimportant, it helps to understand where they come from.

Whenever you use one of the provider based features the run-time searches for a configured connection string. If your site doesn't explicitly override the settings in web.config, the default of LocalSqlServer is used, which creates a database in the App_Data folder.

So, to fix this for your remote host, you need to do two things:

1. Get the data in the remote server

2. Configure your app to use this new database.

Part one can be tricky if you can't access the server. You haven't described to what extend you can access the server, but there are a few ways to do this:

a) run the .sql script for the providers located in C:\Windows\Microsoft.NET\Framework\v2.0.50727 to create the required tables, views and procedures.
They are called InstallMembership.sql etc

Then use other means, like DTS to get the data in.

b) Use the Database Publishing Wizard, described here: http://www.codeplex.com/sqlhost/Wiki...shing%20Wizard and here: http://weblogs.asp.net/scottgu/archi...-database.aspx

With these tools, you can create SQL scripts that you can execute on your server. You can either do it if you have access, or your host can do it for you.

Part 2 has been described in the article I linked to earlier.

Alternatively, if you keep having troubles using SQL Server, you can Microsoft Access as well, as described here: http://www.spaanjaars.com/QuickDocId.aspx?quickdoc=404
However, that still leaves you with the data in "useless mdf files".

HtH,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old May 1st, 2007, 10:03 PM
Authorized User
 
Join Date: Apr 2007
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks again Imar,

Unfortunately I do not believe I can do these things, but it does not matter because it is not the server/remote host that is the issue.

What I need is sql or CSV files instead of mdf/ldf files locally on my developer computer. Godaddy provides a tool for importing data from an sql or CSV database into the database on server (that I created remotely). So all I need is to start out with an sql/CSV file on my local developer machine, but I don't know how to do that.

So how do I get sql/CSV instead of mdf/ldf on my local developer machine?

 
Old May 2nd, 2007, 01:13 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Did you read my post and follow the links in there?

From the second link:
Quote:
quote:In my first Database Publishing post, I walked through how you can use the Database Publishing Wizard to automatically generate a .SQL installation file that contains the script necessary to recreate your database schema (tables, views, sprocs, triggers, full-text catalogs, etc) and also populate your database with the same table row contents as your original database. This provides a super easy way to put together a .SQL script that entirely automates replicating your database on another server:
If that's not what you want, I don't understand what it is you want to do....

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old May 3rd, 2007, 12:29 AM
Authorized User
 
Join Date: Apr 2007
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry Imar, when I was skimming the article I paid too much attention to the section regarding creating/uploading the database to my server which is something I am not allowed to do. However, then I read it more carefully and I used Database Publishing to create an sql file from the mdf file locally on my machine which is what I asked for, and this worked. Thanks for helping me.

Then I used the godaddy data base manager to import the sql file into the sql database that has been assigned to me. Unfortunately I also got an error because of a syntax error in the sql file generated by Database Publishing. Well, I don't believe there is a syntax error in the sql data base, but this is a different story.

Thank you very much for your help Imar!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Where are the .mdf and .ldf files? mike72 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 March 18th, 2008 11:11 AM
Third party servers and mdf files ThomasWikman ASP.NET 2.0 Basics 13 May 3rd, 2007 12:38 AM
.mdf files no good papakev123 BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 4 April 3rd, 2007 02:35 PM
SQL 2000 MDF files fchaffin BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 3 July 5th, 2006 12:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.