Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > BOOK: Beginning ASP.NET Databases
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
Old April 5th, 2009, 08:12 AM
Imar's Avatar
Wrox Author
Points: 67,317, Level: 100
Points: 67,317, Level: 100 Points: 67,317, Level: 100 Points: 67,317, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,230
Thanks: 66
Thanked 1,416 Times in 1,396 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!
Reply With Quote
  #3 (permalink)  
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
Reply With Quote
  #4 (permalink)  
Old April 6th, 2009, 02:25 PM
Imar's Avatar
Wrox Author
Points: 67,317, Level: 100
Points: 67,317, Level: 100 Points: 67,317, Level: 100 Points: 67,317, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,230
Thanks: 66
Thanked 1,416 Times in 1,396 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!
Reply With Quote
  #5 (permalink)  
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
Reply With Quote
Reply


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 07:38 AM
Database Connection Error werD420 Classic ASP Databases 12 January 20th, 2005 12:52 PM
Server error for database connection frankv25 ASP.NET 1.0 and 1.1 Basics 5 August 14th, 2004 07:33 AM



All times are GMT -4. The time now is 03:43 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.