Adding informations in a database from an asp web site

When someone register or submit a message on the site,that information

Page 1 of 1

3 Replies - 956 Views - Last Post: 25 March 2009 - 04:39 AM Rate Topic: -----

#1 BogdanPlayer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 24-March 09

Adding informations in a database from an asp web site

Post icon  Posted 24 March 2009 - 02:31 PM

I've made and ASP web site with Visual Web Developer and I've added on one of my pages
a register form.When someone create an account I want that all informations from there
to be added on a database that I've made in C# and I've added to my project.
And I've made a contact form and when someone will submit a message,his name,email and message
to be added on that database.What is the code that I must put at the register button or
at the send button for doing that?
And how I can do that all that register on the site be able to login on the site?

Is This A Good Question/Topic? 0
  • +

Replies To: Adding informations in a database from an asp web site

#2 b.ihde  Icon User is offline

  • D.I.C for life
  • member icon

Reputation: 44
  • View blog
  • Posts: 1,070
  • Joined: 29-September 08

Re: Adding informations in a database from an asp web site

Posted 25 March 2009 - 02:08 AM

Hello and welcome to DreamInCode!

Please show us what you have tried so far..

[rules][/rules]

B.Ihde
Was This Post Helpful? 0
  • +
  • -

#3 BogdanPlayer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 24-March 09

Re: Adding informations in a database from an asp web site

Posted 25 March 2009 - 04:35 AM

There is the code from the master page:
<%@ Master Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

	protected void Page_Load(object sender, EventArgs e)
	{

	}

	protected void LoginStatus1_LoggingOut(object sender, LoginCancelEventArgs e)
	{

	}

	protected void LoginButton_Click(object sender, EventArgs e)
	{

	}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head id="Head1" runat="server">
	<title>De ce ma joc?</title>

</head>
<body>
	<div id="sizer">
		<div id="expander">
			<div id="wrapper" class="clearfix">
				<form id="mainForm" runat="server">
					<a href="#maincontent" id="skiptocontent" title="Click this link to navigate directly to this page's content.">Skip to main content</a>
					<div id="leftcolumn">
						<div id="leftcoltop">
						<asp:Button ID="AdminButton" runat="server" Text="Admin" 
								PostBackUrl="~/Admin/default.aspx" />
						</div>
						<div id="loginbox">

							<asp:Login ID="Login1" runat="server" Width="120px" 
								DestinationPageUrl="~/Default.aspx">
								<LayoutTemplate>
									<h4>Logare</h4>
									<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName"><u>N</u>ume:</asp:Label><br />
									<asp:TextBox ID="UserName" runat="server" AccessKey="u" TabIndex="60" Columns="15" />
									<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
										ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator><br />
									<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password"><u>P</u>arola:</asp:Label><br />
									<asp:TextBox ID="Password" runat="server" AccessKey="p" TabIndex="61" TextMode="Password" Columns="15" />
									<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
										ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator><br />
									<asp:CheckBox ID="RememberMe" runat="server" Text="Retine datele." TabIndex="62" AccessKey="r" /><br />
									<span style="color: red">
										<asp:Literal ID="FailureText" runat="server" EnableViewState="False" />
									</span>
									<div align="right">
										<asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Logare" 
											ValidationGroup="Login1" TabIndex="62" AccessKey="l" 
											onclick="LoginButton_Click" />
									</div>
								</LayoutTemplate>
							</asp:Login>
						</div>
						<div id="Div1">
						<asp:LoginView ID="LoginView" runat="server">
											<LoggedInTemplate>
												Esti logat ca:
											</LoggedInTemplate>
											<AnonymousTemplate>
												Nu esti logat.
											</AnonymousTemplate>
										</asp:LoginView>
							<asp:LoginName ID="LoginName" runat="server" />
							<br />
							<asp:LoginStatus ID="LoginStatus" runat="server" LoginText="" />
							<br />
						</div>

										


						<div id="leftbarcontainer">
							<div id="leftbar">
								<asp:ContentPlaceHolder runat="server" ID="subnavigation">


								</asp:ContentPlaceHolder>
								<asp:ContentPlaceHolder runat="server" ID="leftbarcontent">

									<div class="leftbaritem">
										<h4>
											Altele</h4>
										<p style="text-align:center;">
											<asp:Image runat="server" ID="image1" SkinID="poza1" /></p>
										<p>
											Arestata pentru o "crima" virtuala</p>
										<div class="readmore">
											<a href="Arestata.aspx" title="More info">Continuare &raquo;</a></div>
										<p style="text-align:center;">
											<asp:Image runat="server" ID="image2" SkinID="poza2" /></p>
										<p>
											Englezii vor juca cricket pe muntele Everest</p>
										<div class="readmore">
											<a href="Cricket.aspx" title="More info">Continuare &raquo;</a><div align="right">
									</div>
										</div>
									</div>
								</asp:ContentPlaceHolder>
							</div>
						</div>
					</div>
					<div id="rightcolumn">
						<div id="rightcoltop">
						<div align="center"	>
						<a href="Contact.aspx" title="Contact Form">Contact</a>
						</div>
						</div>
						<div id="searchbox">
							<div>
								<asp:Label runat="server" ID="lblSearch" AssociatedControlID="txtSearch" style="display:none;" Text="Search:" />
								<asp:TextBox runat="server" ID="txtSearch" AccessKey="s" TabIndex="50" Columns="10" />
								<asp:Button runat="server" ID="btnSearch" Text="Cautare" CausesValidation="false" AccessKey="c" TabIndex="51" />
							</div>
						</div>
						<div id="rightbarcontainer">
							<div id="rightbar">
								<asp:ContentPlaceHolder runat="server" ID="rightbarcontent">

									<div class="rightbaritem">
										<h4>
											Noutati</h4>
										<p>
											Incredibil! Afla care este cel mai de succes joc video al anului</p>
										<div class="readmore">
											<a href="Bush.aspx" title="More info">&raquo; mai mult</a></div>
									</div>
									<div class="rightbaritem">
										<h4>
											Pentru 6 milioane de dolari ajungi in Raiul Gamerilor!</h4>
										<p>
											Jucatorii vor crede ca au murit si ca au ajuns in paradisul videogamerilor daca se vor juca pe acest sistem care a fost botezat "mama tuturor configuratiilor de home entertainment".</p>
										<div class="readmore">
											<a href="6milioane.aspx" title="More info">&raquo; mai mult</a></div>
									</div>
									<div class="rightbaritem">
										<h4>
											Serialul Anatomia lui Grey devine joc video</h4>
										<p>
											Compania Ubisoft a anuntat semnarea unui acord in exclusivitate cu ABC Studios pentru a dezvolta un joc video bazat pe celebrul serial de televiziune american.</p>
										<div class="readmore">
											<a href="Grey.aspx" title="More info">&raquo; mai mult</a><br />
											<br />
											<br />
											<br />
											<br />
											<br />
											<br />
											<br />
											<br />
											<br />
											<br />
											<br />
											<br />
											<br />
											<br />
											<br />
										</div>
									</div>
								</asp:ContentPlaceHolder>
							</div>
						</div>
					</div>
					<div id="centercolumn">
						<div id="centercoltop"></div>
						<div id="header">
						
						</div>
	  <div class="menu">
	  <div align="center">
		  <asp:Menu ID="Menu" runat="server" BackColor="#B5C7DE" DynamicHorizontalOffset="2" 
			   Font-Bold="True" Font-Names="Comic Sans MS" Font-Size="Small" 
			   ForeColor="#284E98" Orientation="Horizontal" StaticSubMenuIndent="10px">
			  <StaticSelectedStyle BackColor="#507CD1" />
			  <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
			  <DynamicHoverStyle BackColor="#284E98" ForeColor="White" />
			  <DynamicMenuStyle BackColor="#B5C7DE" />
			  <DynamicSelectedStyle BackColor="#507CD1" />
			  <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
			  <StaticHoverStyle BackColor="#284E98" ForeColor="White" />
			  <Items>
				  <asp:MenuItem Text="Acasă" NavigateUrl="~/Default.aspx">
				  </asp:MenuItem>
				  <asp:MenuItem Text="Jocul">
					  <asp:MenuItem Text="Industria jocurilor video" />
					  <asp:MenuItem Text="Jocuri video in biblioteci" />
					  <asp:MenuItem Text="Jocuri video controlate mental " />
					  <asp:MenuItem Text="Universul jocurilor video" />
					  <asp:MenuItem Text="Universul jocurilor video(2)" />
					  <asp:MenuItem Text="Copiii si jocurile video" />
				  </asp:MenuItem>
				  <asp:MenuItem Text="Efecte">
					  <asp:MenuItem Text="Pozitive">
						  <asp:MenuItem Text="Muschii fetei, antrenati printr-un joc video " />
						  <asp:MenuItem Text="Jocurile video si cancerul" />
						  <asp:MenuItem Text="Jocurile violente nu formeaza asasini!" />
					  </asp:MenuItem>
					  <asp:MenuItem Text="Negative">
						  <asp:MenuItem Text="Jocurile violente cresc agresivitatea" />
					  </asp:MenuItem>
				  </asp:MenuItem>
				  <asp:MenuItem Text="Alegerea mea">
				  </asp:MenuItem>
				  <asp:MenuItem Text="Combaterea pirateriei">
				  </asp:MenuItem>
			  </Items>
		  </asp:Menu>

		  <br />

</div>
</div>
						<div id="maincontent">
							<asp:ContentPlaceHolder runat="server" ID="content">
												
								
												
							</asp:ContentPlaceHolder>
						</div>
						<div id="footer">
							&nbsp;Bogdan Design
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</body>
</html>



And there the code from the contact form:
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" Title="Contact" CodeFile="~/Contact.aspx.cs" Inherits="Contact" %>

<asp:Content runat="server" ContentPlaceHolderID="subnavigation" >

</asp:Content>

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="content">
	<h1>Contact<asp:Label ID="LabelContactFalse" runat="server" 
				
			
			style="z-index: 1; left: 602px; top: 262px; position: absolute; height: 76px; width: 151px;" Text="Nu ati completat toate campurile!" 
				Visible="False" Font-Bold="True" Font-Size="Large"
			Font-Underline="True" ForeColor="Red" TabIndex="18"></asp:Label>
		</h1>
	<p style="color: #FFFFFF">
		Completaţi formularul pentru a putea trimite mesajul !<asp:Label 
			ID="LabelContactTrue" runat="server" Font-Bold="True" Font-Size="Large" 
			Font-Underline="True" ForeColor="Red" 
			style="z-index: 1; left: 603px; top: 340px; position: absolute; height: 57px; width: 169px; margin-top: 4px; margin-left: 0px;" 
			Text="Ati trimis mesajul cu succes!" Visible="False"></asp:Label>
	</p>
	<div id="contactForm">
		<fieldset style="width: 300px;">
			<legend>Cine eşti</legend><asp:Label ID="Label1" runat="server" 
				AssociatedControlID="txtName" Text="&lt;u&gt;N&lt;/u&gt;ume" 
				ForeColor="White" /><br />
			<asp:TextBox ID="txtName" runat="server" AccessKey="n" TabIndex="10" /><br />
			<asp:Label ID="Label2" runat="server" AssociatedControlID="txtEmail" 
				Text="E&lt;u&gt;m&lt;/u&gt;ail" ForeColor="White" /><br />
			<asp:TextBox ID="txtEmail" runat="server" AccessKey="m" TabIndex="12" /><br />
			<br />
		</fieldset>		
		<fieldset style="width: 300px;">
			<legend>Ce ai de spus</legend>
			<asp:Label ID="Label4" runat="server" AssociatedControlID="rblImportance" 
				Text="Importanţa:" ForeColor="White" />
			<asp:RadioButtonList ID="rblImportance" runat="server" 
				RepeatDirection="Horizontal" RepeatLayout="Flow" TabIndex="14" 
				ForeColor="White">
				<asp:ListItem Value="low">Mică</asp:ListItem>
				<asp:ListItem Selected="True" Value="normal">Normală</asp:ListItem>
				<asp:ListItem Value="high">Mare</asp:ListItem>
			</asp:RadioButtonList><br /><br />
			<asp:Label ID="Label5" runat="server" AssociatedControlID="txtMessage" 
				Text="M&lt;u&gt;e&lt;/u&gt;saj" ForeColor="White" /><br />
			<asp:TextBox ID="txtMessage" runat="server" TextMode="MultiLine" Columns="30" Rows="6" AccessKey="e" TabIndex="15" />			
		</fieldset><fieldset style="width:300px;">
			<legend>Abonare la newsletter</legend>
			<asp:Label ID="Label6" runat="server" AssociatedControlID="rblImportance" 
				Text="Veţi primi periodic, prin e-mail, ultimele ştiri adăugate pe site." ForeColor="White" />
			<asp:RadioButtonList ID="rblSubscribe" runat="server" TabIndex="16" 
				ForeColor="White">
				<asp:ListItem Selected="True" Value="true">Sigur.</asp:ListItem>
				<asp:ListItem Value="false">Nu, mulţumesc.</asp:ListItem>
			</asp:RadioButtonList>
		</fieldset><asp:Button ID="btnSubmit" runat="server" 
				Text="Trimite" TabIndex="17" AccessKey="d" onclick="btnSubmit_Click" 
			style="left: 236px; top: 834px" />
			<div style="margin-top:1em;">
				<br />
				<br />
				<br />
		</div>
	</div>
</asp:Content>


Currently I'm working at the regsiter page.That will be ready today.
Was This Post Helpful? 0
  • +
  • -

#4 searockruz  Icon User is offline

  • D.I.C Regular

Reputation: 24
  • View blog
  • Posts: 460
  • Joined: 07-March 09

Re: Adding informations in a database from an asp web site

Posted 25 March 2009 - 04:39 AM

well i suggest you to read asp.net and c# tutorials in dream in code if your stuck with database interaction

This post has been edited by searockruz: 25 March 2009 - 04:41 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1