Wrox Programmer Forums
|
BOOK: Beginning ASP.NET Databases Also see the forum ASP Databases for more general discussions of ASP database issues not directly related to these books.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET Databases 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 3rd, 2009, 05:59 AM
Authorized User
 
Join Date: Mar 2009
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Error in database connection

I have created the user form with the help of createnewuser control in Asp.net c#. In the same form I have added one more form to collect the user contact details and I have created the table for that in .mdf file.

In the .cs file I have written below mentioned code to gather the user data, but it works fine in local server and remote server it gives error.

The code :

protectedvoid CreateUserWizard1_CreatedUser(object sender, EventArgs e)
{
TextBox UserNameTextBox =
(
TextBox)CreateUserWizardStep2.ContentTemplateContainer.Fi ndControl("UserName");
SqlDataSource DataSource =
(
SqlDataSource)CreateUserWizardStep2.ContentTemplateContainer.Fi ndControl("InsertExtraInfo");
MembershipUser User = Membership.GetUser(UserNameTextBox.Text);
object UserGUID = User.ProviderUserKey;
DataSource.InsertParameters.Add(
"UserId", UserGUID.ToString());
DataSource.Insert();

The error what I am getting is:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

I have the SQL server IP address, port no. username and password.

Pl. let me know how to fix this error.
Apurva
 
Old April 5th, 2009, 08:12 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Are you working with the built-in Membership provider or is this your own database?

The providers by default will look for a database on .\SqlExpress unless you tell it look elsewhere....

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old April 6th, 2009, 12:06 AM
Authorized User
 
Join Date: Mar 2009
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy error in database connection

Yes, I am working with the built-in Membership provider.

I hope I have to write some code in Create user button, please let me know how it is to be written and in the web.config file I have mentioned the sql details in below mentioned way. Let me know whether it is correct.

<addname="ASPNETDBConnectionString"connectionString="Data Source=208.115.36.160;Initial Catalog=ASPNETDB.MDF;uid=aspnetdb;pwd=vviu39c734dx"
providerName="System.Data.SqlClient" />

early waiting for reply.

Thanking you,
Apurva
 
Old April 6th, 2009, 02:25 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,

You can take a look here: http://weblogs.asp.net/scottgu/archi...25/423703.aspx to learn how to reconfigure the providers to work with your own database.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old April 11th, 2009, 06:35 AM
Registered User
 
Join Date: Apr 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you're using SQL Server Express Edition, the remote connection to the SQL server are blocked by default so you must to enable it. Follow the link below for detail steps.

Enable remote connection to SQL Server 2005 Express





Similar Threads
Thread Thread Starter Forum Replies Last Post
Database connection error lappling General .NET 0 April 20th, 2006 07:48 AM
Database connection error help me hasham Pro JSP 1 March 21st, 2006 08:38 AM
Database Connection Error werD420 Classic ASP Databases 12 January 20th, 2005 01:52 PM
Server error for database connection frankv25 ASP.NET 1.0 and 1.1 Basics 5 August 14th, 2004 07:33 AM





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