472,958 Members | 2,434 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

"Unable to connect to SQL Server database" error when using profile

Hello,

I'm using CreateUserWizard control in ASP.NET 2.0. I'm storing the data in
SQL Server 2005.

The first and last steps run smoothly without any problems. But I added one
middle step to collect some other information from the user. I've added this
to Web.config:

<profile>
<properties>
<add name="FirstName" />
<add name="LastName" />
<add name="Country" />
<add name="City" />
<add name="Email2" />
</properties>
</profile>

Then I try to collect this data:

Protected Sub cuzGudzon_FinishButtonClick(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.WizardNavigationEventArg s) Handles
cuzGudzon.FinishButtonClick
Try
With Profile
..FirstName = Me.txtFirstName.Text
..LastName = Me.txtLastName.Text
..Country = Me.txtCountry.Text
..City = Me.txtCity.Text
..Email2 = Me.txtEmail2.Text
End With
Catch ex As Exception
Me.lblError.Text = ex.Message
Finally
End Try
End Sub

This is where I get an error: Unable to connect to SQL Server database

Aparently, the connection string I specified in Web.config is correct, since
the first step where the user creates a user name and password runs without
any problems, and the data is entered into the database. Am I missing
something in this additional step?

I would appreciate your help.

Thank you,

--
Peter Afonin
Oct 8 '06 #1
2 6297
Make sure you have set up the Profile to use the proper connection string.
Membership and Profile are two completely separate sections in the
web.config. Same is true for Roles. While this may seem counter intuitive,
the reason for this is flexibility, as you might want to include the default
membership, but custom profile and role providers. You can do this with a
simple config change (and code to support the custom elements, of course).

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com/

*************************************************
Think Outside the Box!
*************************************************
"Peter Afonin" <pa*****@hotmail.comwrote in message
news:ua**************@TK2MSFTNGP04.phx.gbl...
Hello,

I'm using CreateUserWizard control in ASP.NET 2.0. I'm storing the data in
SQL Server 2005.

The first and last steps run smoothly without any problems. But I added
one middle step to collect some other information from the user. I've
added this to Web.config:

<profile>
<properties>
<add name="FirstName" />
<add name="LastName" />
<add name="Country" />
<add name="City" />
<add name="Email2" />
</properties>
</profile>

Then I try to collect this data:

Protected Sub cuzGudzon_FinishButtonClick(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.WizardNavigationEventArg s) Handles
cuzGudzon.FinishButtonClick
Try
With Profile
.FirstName = Me.txtFirstName.Text
.LastName = Me.txtLastName.Text
.Country = Me.txtCountry.Text
.City = Me.txtCity.Text
.Email2 = Me.txtEmail2.Text
End With
Catch ex As Exception
Me.lblError.Text = ex.Message
Finally
End Try
End Sub

This is where I get an error: Unable to connect to SQL Server database

Aparently, the connection string I specified in Web.config is correct,
since the first step where the user creates a user name and password runs
without any problems, and the data is entered into the database. Am I
missing something in this additional step?

I would appreciate your help.

Thank you,

--
Peter Afonin

Oct 8 '06 #2
Thank you, Gregory,

This was a main problem - I couldn't find any example on how to do this.
Finally figured this out:

<profile defaultProvider="GudzonProfileProvider">
<providers>
<add name="GudzonProfileProvider"
type="System.Web.Profile.SqlProfileProvider" connectionStringName="Gudzon"/>
</providers>
<properties>
<add name="FirstName" />
<add name="LastName" />
<add name="Country" />
<add name="City" />
<add name="Email2" />
</properties>
</profile>

Peter

"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote in
message news:%2****************@TK2MSFTNGP04.phx.gbl...
Make sure you have set up the Profile to use the proper connection string.
Membership and Profile are two completely separate sections in the
web.config. Same is true for Roles. While this may seem counter intuitive,
the reason for this is flexibility, as you might want to include the
default membership, but custom profile and role providers. You can do this
with a simple config change (and code to support the custom elements, of
course).

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com/

*************************************************
Think Outside the Box!
*************************************************
"Peter Afonin" <pa*****@hotmail.comwrote in message
news:ua**************@TK2MSFTNGP04.phx.gbl...
>Hello,

I'm using CreateUserWizard control in ASP.NET 2.0. I'm storing the data
in SQL Server 2005.

The first and last steps run smoothly without any problems. But I added
one middle step to collect some other information from the user. I've
added this to Web.config:

<profile>
<properties>
<add name="FirstName" />
<add name="LastName" />
<add name="Country" />
<add name="City" />
<add name="Email2" />
</properties>
</profile>

Then I try to collect this data:

Protected Sub cuzGudzon_FinishButtonClick(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.WizardNavigationEventArg s) Handles
cuzGudzon.FinishButtonClick
Try
With Profile
.FirstName = Me.txtFirstName.Text
.LastName = Me.txtLastName.Text
.Country = Me.txtCountry.Text
.City = Me.txtCity.Text
.Email2 = Me.txtEmail2.Text
End With
Catch ex As Exception
Me.lblError.Text = ex.Message
Finally
End Try
End Sub

This is where I get an error: Unable to connect to SQL Server database

Aparently, the connection string I specified in Web.config is correct,
since the first step where the user creates a user name and password runs
without any problems, and the data is entered into the database. Am I
missing something in this additional step?

I would appreciate your help.

Thank you,

--
Peter Afonin


Oct 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: a | last post by:
I keep getting this message, "unable to get the project file from the web server" when I try to open a new project that I just copied. I created a virtual director with IIS 5 (VS2002). Trying to...
2
by: Luke | last post by:
Hi I have the following code which is an ASP questionnaire using an Access database. (I am using access as I have no choice!). Basically there is an html form which submits the form to the page...
5
by: Bruce Schechter | last post by:
I just started to develop an ASP.NET application in vs.net 2003 . But each time I try to execute the application (which is basically empty so far), I get a dialog box titled "Microsoft Development...
3
by: ADavidson | last post by:
I'm getting a {"Parser Error: The Runat attribute must have the value Server." } error when I try to get the Server.GetlastError() in the Global.asax codebehind. Why am I getting this? I...
10
by: VB Programmer | last post by:
1. Is there an ASP.NET 2.0 version available yet? 2. Is there a VB.NET version available? 3. How do I install the source version on my dev machine (I have SQL Server 2000, VS.NET, IIS, etc...)...
4
by: Ryan | last post by:
Hello, I have a standard HTML button on an aspx web form that I have set to runat server. The button is named reset1 and its tag is as follows: <INPUT id="btnReset1" style="WIDTH: 60px;...
2
by: Andy Chen | last post by:
Hi, When I am using the fowllowing code to open page http://spaces.msn.com/members/mailcall/ .... try{ string url = http://spaces.msn.com/members/mailcall/; HttpWebRequest httpReq = null;...
3
by: Joanne | last post by:
I have searched through previous threads regarding this error. I went back through all my code to make sure I closed and set to nothing all open db's and rs's. However, I still have one computer...
1
by: Tito Meinrath | last post by:
Hi, I'm really going mad about this! Currently I'm designing a student course on web services. Because I want them to understand what's really going on when web services correspond with each...
3
by: praveenb000 | last post by:
we hosted a website http://academics.rsrl.in/ developed using asp.net and back end MS Accees database. when i browse aspx pages Server Application Unavailable The web application...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.