473,503 Members | 1,629 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Modifying and Using the Default aspnetdb Database

76 New Member
I have searched all over the internets for a solution to this problem and there are many ways to work around it but I'm wondering if there is a more simple solution.
I have asp.net 2.0 working with SQL Server 2005 Express and IIS 5.0. I made a page that contains the CreateUserWizard so people can get access to rest of my applications. Using the default (asp:CreateUserWizard) allows us to store data such as username, email address, and password in the aspnetdb database using this provider.
[HTML]<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=aspnetdb;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>[/HTML]
Now I want to store some more data related to the user so I open up the SQL Server Management Studio. I navigate to +MyServer +Databases +aspnetdb +Tables and modify the dbo.aspnet_Users table ADDING 2 columns named;
FirstName nvarchar(50) null
and
LastName nvarchar(50) null
Now I create the text boxes for these new fields in my createuser.aspx page with the following code;
[HTML]<asp:CreateUserWizardStep runat="server">
<ContentTemplate>
<table border="0">
<tr>
<td align="center" colspan="2">
Please fill in all the fields.</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="FirstNameLabel" runat="server" AssociatedControlID="FirstName">First Name</asp:Label>
</td>
<td>
<asp:TextBox ID="FirstName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="FirstNameRequired" runat="server" ControlToValidate="FirstName" ErrorMessage="First Name Is Required." ToolTip="First name is required" ValidationGroup="CreateUserWizard1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="LastNameLabel" runat="server" AssociatedControlID="LastName">Last Name</asp:Label>
</td>
<td>
<asp:TextBox ID="LastName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="LastName" ErrorMessage="Last Name Is Required." ToolTip="Last name is required" ValidationGroup="CreateUserWizard1"></asp:RequiredFieldValidator>
</td>
</tr>
and so on with the rest of the default controls...
[/HTML]
Now, how do I get ASP to recognize that it should be storing FirstName and LastName into the aspnetdb_users table? I've tried just running the page the way it is now and I get no errors but the data entered into the new TextBox controls does not get saved into the aspnetdb_users table. After looking though out the internet I have found many different ways of doing this but the best one I like the most is done by catching the OnCreatedUser event from the CreateUserWizard and it takes the text entered in the new controls and saves it somehow. This is what stumps me here because all of the tutorials I've seen leaves this procedure empty.
So I add this to the asp:createuserwizard
[HTML]<asp:CreateUserWizard ID="CreateUserWizard1" OnCreatedUser="CreateUserWizard1_CreatedUser()" runat="server">[/HTML]
and in the <script runat="server"> I add something like this???
[HTML]<script runat="server">
Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal E As EventArgs) Handles CreateUserWizard1.CreatedUser
Dim FName As TextBox
Dim LName As TextBox
Dim UserID As TextBox
FName = CType(FindControl("FirstName"), TextBox)
LName = CType(FindControl("LastName"), TextBox)
UserID = CType(FindControl("UserName"), TextBox) 'This lets me match to the newly created record in the table...
??? save FName.innertext TO aspnetdb_users.FirstName WHERE UserID.innertext = aspnetdb_users.UserName
save LName.innertext TO aspnetdb_users.LastName WHERE UserID.innertext = aspnetdb_users.UserName
This is where I have a problem. I really need to figure this out also because I plan on creating an order entry database with asp for the front end in the near future.
End Sub
</script>[/HTML]

Thanks,
James
Feb 25 '08 #1
1 2948
kcddoorman
76 New Member
I ended up storing the extra data in profile using Guthries method.
Mar 5 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
3052
by: VB Programmer | last post by:
My web hoster says that I have to rename my ASPNETDB.MDF SqlExpress db for my 2.0 site to work. Is this accurate? If so, how can I rename it without breaking anything on my site? FYI: This is...
3
1624
by: Carl M. | last post by:
Okay, I'm 18 hours into this now and am at a loss. What I've done is create an application on my local workstation using VWD Express using the membership/roles provider and SQL Server Express...
1
1695
by: Derek | last post by:
I am trying to deploy a web site on a server but I am having problems with the ASPNETDB database. It works fine in development on my PC but as SQL Server 2005 Express Edition only supports local...
4
5633
by: jeffreywgraham | last post by:
A word of warning, I am new to .NET and fairly new to SQL Server. The problem I have must be a common one, but I am uable to make it work. I have a .NET project and have the user management and...
2
4210
by: Sasquatch | last post by:
I'm having trouble creating a simple login page using the asp:login control. I followed some instructions in a WROX book, "Beginning ASP.NET 2.0," and the instructions are very straight forward,...
4
3634
by: R.A.M. | last post by:
Hello, I am learning ASP.NET. In web application I am programming now I decided to add a table "Users" to aspnetdb database (with extra data about users) and a trigger AFTER UPDATE of...
1
1820
by: CFTK | last post by:
This is the error I get when I try to login in my application from another machine: An attempt to attach an auto-named database for file C:\Documents and Settings\....\App_Data\aspnetdb.mdf...
3
8706
by: Paul | last post by:
Hello All, I am working through the SAMS "ASP.NET 2.0 - Unleased" book to teach myself ASP.NET. It is a great book, but Chapter 21 "Using ASP.NET Membership" is causing me problems - or maybe I...
0
1361
by: aboutjav.com | last post by:
Hi, How do I attach the .mdf and .ldf with the SQL Server Management Studio Express? Do I attached all 4 files? MyWebSiteName_log.LDF MyWebSiteName.mdf ASPNETDB.MDF aspnetdb_log.ldf
0
7198
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4998
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.