Transfer data from webform to sql database

I need to write a simple user registration page that allows the user to enter their information into text fields. Once all the information is filled in the data needs to be tranferred to an sql database. The database is set up and ready to recieve the information. I'm sure that this topic has been broached in another thread but I wasn't able to find it. If someone could offer me a link or some personal advice that would help me  accomplish my goal I would appreciate it immensely.

Thanks, Bill

0
bill777
1/8/2006 9:50:07 PM
asp.net.getting-started 91979 articles. 3 followers. Follow

3 Replies
558 Views

Similar Articles

[PageSpeed] 46

So, what problem are you having? You can show us some code and we can help you to solve your problems! 

HighOnCoding
Wanna get high!
0
azamsharp
1/9/2006 1:44:26 AM

Take a look at the tutorials on this site (ww.asp.net).

Jeff


Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
0
jeff
1/9/2006 3:03:55 AM

When I hit the submit button a new record is created in my database but the only value created is the PrimaryID which is autogenerated, the rest of the fields are null. I know that I don't have my fields assigned correctly so that the insert command recognizes them as the data to put into the database, but I'm having a hard time finding out how to do that.

I read about a ControlParameter feature of the SqlDatasource where you could assign a collection of controls, but the only property that uses a collection on my SqlDatasource is FilterParameters which is of course not what I want.

Any help would be greatly appreciated. Thanks, Bill.

 

 

<%@ Page Language="C#" MasterPageFile="~/MySchoolFees.master" AutoEventWireup="true" CodeFile="registration.aspx.cs" Inherits="registration" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<table width="100%" cellspacing="8">

<tr>

<td colspan="3" bgcolor="#5e6ac6">

<span style="color: buttonface">User Name and Password</span></td>

</tr>

<tr>

<td>

Email</td>

<td>

<asp:TextBox ID="Email" runat="server"></asp:TextBox>

</td>

<td>

</td>

</tr>

<tr>

<td>

Confirm Email</td>

<td>

<asp:TextBox ID="ConfirmEmail" runat="server"></asp:TextBox>

</td>

<td>

</td>

</tr>

<tr>

<td>

Password</td>

<td>

<asp:TextBox ID="Password" runat="server"></asp:TextBox>

</td>

<td>

</td>

</tr>

<tr>

<td>

Confirm Password</td>

<td>

<asp:TextBox ID="ConfirmPassword" runat="server"></asp:TextBox>

</td>

<td>

</td>

</tr>

<tr>

<td>

</td>

<td>

</td>

<td>

</td>

</tr>

<tr>

<td bgcolor="#5e6ac6" colspan="3">

<span style="color: buttonface">Registration Information</span></td>

</tr>

<tr>

<td>

First Name</td>

<td>

<asp:TextBox ID="FirstName" runat="server"></asp:TextBox>

</td>

<td>

&nbsp;</td>

</tr>

<tr>

<td>

Last Name</td>

<td>

<asp:TextBox ID="LastName" runat="server"></asp:TextBox>

</td>

<td>

</td>

</tr>

<tr>

<td style="height: 25px">

Address 1</td>

<td style="height: 25px">

<asp:TextBox ID="Address1" runat="server"></asp:TextBox>

</td>

<td style="height: 25px">

</td>

</tr>

<tr>

<td style="height: 27px">

Address 2</td>

<td style="height: 27px">

<asp:TextBox ID="Address2" runat="server"></asp:TextBox>

</td>

<td style="height: 27px">

</td>

</tr>

<tr>

<td style="height: 25px">

City</td>

<td style="height: 25px">

<asp:TextBox ID="City" runat="server"></asp:TextBox>

</td>

<td style="height: 25px">

</td>

</tr>

<tr>

<td>

State</td>

<td>

<asp:DropDownList ID="State" runat="server" DataSourceID="StateSqlDatasource" DataTextField="StateName" DataValueField="StateName">

</asp:DropDownList><asp:SqlDataSource ID="StateSqlDatasource" runat="server" ConnectionString="<%$ ConnectionStrings:StatesConnectionString %>"

SelectCommand="SELECT [StateName] FROM [States]"></asp:SqlDataSource>

</td>

<td>

</td>

</tr>

<tr>

<td>

Zip Code</td>

<td>

<asp:TextBox ID="Zip" runat="server"></asp:TextBox>

</td>

<td>

</td>

</tr>

<tr>

<td>

Phone</td>

<td>

<asp:TextBox ID="Phone" runat="server"></asp:TextBox>

</td>

<td>

</td>

</tr>

<tr>

<td>

</td>

<td align="right">

<asp:Button ID="SubmitButton" runat="server" Text="Submit" OnClick="SubmitButton_Click" />

<asp:Button ID="CancelButton" runat="server" Text="Cancel" />

</td>

<td>

</td>

</tr>

</table>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"

ConnectionString="<%$ ConnectionStrings:TES_AwSql_ConnectionString %>" DeleteCommand="DELETE FROM [SqlFam] WHERE [Fam_Id] = @original_Fam_Id AND Email [Email] = @original_Email AND [Password] = @original_Password AND [FirstName] = @original_FirstName AND [LastName] = @original_LastName AND [Address1] = @original_Address1 AND [Address2] = @original_Address2 AND [City] = @original_City AND [State] = @original_State AND [Zip] = @original_Zip AND [Phone] = @original_Phone AND [LastTransaction] = @original_LastTransaction"

InsertCommand="INSERT INTO [SqlFam] (Email [Email], [Password], [FirstName], [LastName], [Address1], [Address2], [City], [State], [Zip], [Phone], [LastTransaction]) VALUES (@Email, @Password, @FirstName, @LastName, @Address1, @Address2, @City, @State, @Zip, @Phone, @LastTransaction)"

OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [SqlFam]"

UpdateCommand="UPDATE [SqlFam] SET Email [Email] = @Email, [Password] = @Password, [FirstName] = @FirstName, [LastName] = @LastName, [Address1] = @Address1, [Address2] = @Address2, [City] = @City, [State] = @State, [Zip] = @Zip, [Phone] = @Phone, [LastTransaction] = @LastTransaction WHERE [Fam_Id] = @original_Fam_Id AND Email [Email] = @original_Email AND [Password] = @original_Password AND [FirstName] = @original_FirstName AND [LastName] = @original_LastName AND [Address1] = @original_Address1 AND [Address2] = @original_Address2 AND [City] = @original_City AND [State] = @original_State AND [Zip] = @original_Zip AND [Phone] = @original_Phone AND [LastTransaction] = @original_LastTransaction" CancelSelectOnNullParameter="False" OnSelecting="SqlDataSource1_Selecting1">

<DeleteParameters>

<asp:Parameter Name="original_Fam_Id" Type="Int32" />

<asp:Parameter Name="original_Email" Type="String" />

<asp:Parameter Name="original_Password" Type="String" />

<asp:Parameter Name="original_FirstName" Type="String" />

<asp:Parameter Name="original_LastName" Type="String" />

<asp:Parameter Name="original_Address1" Type="String" />

<asp:Parameter Name="original_Address2" Type="String" />

<asp:Parameter Name="original_City" Type="String" />

<asp:Parameter Name="original_State" Type="String" />

<asp:Parameter Name="original_Zip" Type="String" />

<asp:Parameter Name="original_Phone" Type="String" />

<asp:Parameter Name="original_LastTransaction" Type="Int32" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="Email" Type="String" />

<asp:Parameter Name="Password" Type="String" />

<asp:Parameter Name="FirstName" Type="String" />

<asp:Parameter Name="LastName" Type="String" />

<asp:Parameter Name="Address1" Type="String" />

<asp:Parameter Name="Address2" Type="String" />

<asp:Parameter Name="City" Type="String" />

<asp:Parameter Name="State" Type="String" />

<asp:Parameter Name="Zip" Type="String" />

<asp:Parameter Name="Phone" Type="String" />

<asp:Parameter Name="LastTransaction" Type="Int32" />

<asp:Parameter Name="original_Fam_Id" Type="Int32" />

<asp:Parameter Name="original_Email" Type="String" />

<asp:Parameter Name="original_Password" Type="String" />

<asp:Parameter Name="original_FirstName" Type="String" />

<asp:Parameter Name="original_LastName" Type="String" />

<asp:Parameter Name="original_Address1" Type="String" />

<asp:Parameter Name="original_Address2" Type="String" />

<asp:Parameter Name="original_City" Type="String" />

<asp:Parameter Name="original_State" Type="String" />

<asp:Parameter Name="original_Zip" Type="String" />

<asp:Parameter Name="original_Phone" Type="String" />

<asp:Parameter Name="original_LastTransaction" Type="Int32" />

</UpdateParameters>

<InsertParameters>

<asp:Parameter Name="Email" Type="String" />

<asp:Parameter Name="Password" Type="String" />

<asp:Parameter Name="FirstName" Type="String" />

<asp:Parameter Name="LastName" Type="String" />

<asp:Parameter Name="Address1" Type="String" />

<asp:Parameter Name="Address2" Type="String" />

<asp:Parameter Name="City" Type="String" />

<asp:Parameter Name="State" Type="String" />

<asp:Parameter Name="Zip" Type="String" />

<asp:Parameter Name="Phone" Type="String" />

<asp:Parameter Name="LastTransaction" Type="Int32" />

</InsertParameters>

<FilterParameters>

<asp:ControlParameter ControlID="Email" Name="Email" PropertyName="Text" />

<asp:ControlParameter ControlID="Password" Name="Password" PropertyName="Text" />

<asp:ControlParameter ControlID="FirstName" Name="FirstName" PropertyName="Text" />

<asp:ControlParameter ControlID="FirstName" Name="LastName" PropertyName="Text" />

<asp:ControlParameter ControlID="Address1" Name="Address1" PropertyName="Text" />

<asp:ControlParameter ControlID="Address2" Name="Address2" PropertyName="Text" />

<asp:ControlParameter ControlID="City" Name="City" PropertyName="Text" />

<asp:ControlParameter ControlID="State" Name="State" PropertyName="SelectedValue" />

<asp:ControlParameter ControlID="Zip" Name="Zip" PropertyName="Text" />

<asp:ControlParameter ControlID="Phone" Name="Phone" PropertyName="Text" />

<asp:Parameter DefaultValue="null" Name="LastTransaction" />

</FilterParameters>

</asp:SqlDataSource>

</asp:Content

0
bill777
1/9/2006 10:27:40 PM
Reply:

Similar Artilces:

passing data from controls to session then taking the data and writing custom sql queries to get data from the database
Hi, I'm making a property search. I want to get data from controls and store in a session object which saved in the session until remove or close the browser so on the next page I can take the data stored in the session and use it to write a custom sql query using vb.net or stored procedure to get data from the database and then display the date in the list of results page. Can anyone help with this or forward me to some tutorials that could help me. ThanksAndy Current project: Cycle round the world Heytry thissession["name"]=TextBoxName.Text; And in ...

How to Data Transfer From Excel to Microsoft SQL Server Data base Using .Net.
Hai All, How to Data Transfer From Excel to Microsoft SQL Server Data base Using .Net. I have one Excel Sheet in that sheet 15 Fields (attributes) and 3000 records are there. In this 3000 records i want to store this (Excel) data into  5 related tables on Sql Server Database Using .Net.   How to store Excel Sheet data into Sql Server database. Please help me as soon as possible. Thank You Very Much...Have a Good Day... With RegardsSridhar...

Where should I start if I want to make a new Address book data source to get data from an obdc database?
Where should I start if I want to make a new Address book data source to get data from an obdc database? ...

How can I get the 'entire' database, structure and data, from SQL server 2008 to SQL server 2005?
1) I can't get the 'copy database' function to work from SQL Server 2008 to SQL Server 2005. I connect ok. Everything goes to the last step and then it fails.2) I cant get a SQL server 2008 backup to restore on SQL SEerver 2005 either. The only way I know that works is to script the creation of all tables then export and import. This does work. How can I get the 'entire' database, structure and data, from 2008 to 2005? ThanksSQL newbie. Visual Studio 2008 supports a type of project called a database project. You might try importing the schema of t...

data not getting inserted into a sql database
Hi, i have inserted some data into my database using a stored procedure which i call from a gridview.Though my program does not have any errors, the data does not get inserted into the database.I am using  vb and ASP.net with a SQL database. i have a gridview which displays some data and on a button click, certain data should be inserted into the database which doesn happen.here is the code for the stored procedure:   /*    Insert statement for inserting data into INV_Allocation_DB  */  INSERT INTO INV_Allocation_DB     ...

getting data from database, sql server
I want to get data from a data base. My data base can be viewed through the "Solutions Explorer. It appears under "Sql Server". It's called "adb1", so i guess i could discribe its location as PEPELLINI\NETSDK\adb1. It's in the same place as "Nortwind" the code i have so far is this: Dim ds As DataSet Dim MyCommand As SqlDataAdapter Dim myConnection As SqlConnection = New SqlConnection( _ "server=(local)\NetSDK;database=pubs;Integrated Security=SSPI") ds = New DataSet() there are no e...

transfer oracle data to a sql server database?
hi i am working on a project where half the data i'm working with is in an oracle database, and the other in a sql server database. how could i transfer the oracle data to the sql server database, and have the oracle data update itself in the sql server database whenever the oracle data gets updated (weekly builds?) any help would be appreciated as i'm very new to working with databases. thanks in advance! If you want to migrate the data to SQL Server the first two links covers that, the second link is a complete detailed migration guide.  If you just want to write query a...

Writing a function to get data from SQL database
Hi,  I want to write a function, where I supply it with the sql statement, and it will return an array/dataset with the results from the database it it.  I've got this code which I know gets the data. but I don't want to have to write this code all the time.SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString);SqlDataAdapter a = new SqlDataAdapter("select * from navItems WHERE navItemPublished = 'true';", conn);DataSet s = new DataSet();a.Fill(s);foreach (DataRow dr in s.Tables[0].Rows...

Creating a webform to add data to SQL database
I have coded a webform in Webdeveloper.  I created a SUBMIT button that will take the user input on the form to add the record to the database.  I wrote the following to accept the title the user enters on the webform to be added to the SQL database.  I am getting an error message saying PARAMETERS is not a member of 'String' SQLDataSource1.InsertCommand.Parameters(0).Value = txtTitle.text What would I use in this statement instead of Parameters?  Is the entire statement wrong?  Can someone help me out.  Thanks...

Transfer excel data to microsoft sql database
Dear people, can someone show me an example of how I can update an Microsoft SQL table data with an excel sheet. Meaning, when I upload an excel sheet using an ASPX page the data in the excel sheet will be transfer to a particular table in the database. Thank you in advance. Off the cuff, I would write a regular asp.net file upload routine (code available anywhere) and use a SQL Server DTS package to do the transformation for you. The bassplayer is the most important member of a band. Just ask one! Thanks manz.. but as a rookie to asp.net... can u show me where to get example f...

To start loop getting data from database error.
hi, i writing code in Html to start loop, I want get data from database in loop shape because data can be exceeded from 1 value to many. if (HistoryData.Tables[0].Rows.Count > 0)  {  int i = 0;  while (HistoryData.Tables[0].Rows.Count >= i) { dr = HistoryData.Tables[0].Rows[i];  i++; } } i have received message Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS1002: ; expected &nb...

Get data from locked Access Database into SQL
What is they best way to get data from a locked Access database into SQL Server? Linked Server, DTS Package, or should I just directly access it from my App? Thanks. Explain "Locked". You can programatically access an Access database with Jet Security enabled as well as a database with a password. See www.connectionstrings.comStarting with ASP.NET 2.0? Look at:Programming Microsoft Web Forms My Blog Right, since there are several ways to get the data, I was wondering which would give me the greatest amount of flexibility and best performance. Importing it into SQL tab...

Transfering data from a web form into Sql server database
Hi I am trying to develop a web based application. I am trying to insert data from my web form into sql server database using stored procedures. I am having a problem while i try to exceute the command. The error given by system is System.InvalidCastException: Object must implement IConvertible. at System.Data.SqlClient.SqlCommand.ExecuteNonQueryany suggestion what am i missing?With Regards,Sameer Jindal We'd need to see the code in order to offer any suggestions.  Off the top of my head I'd take a wild guess and say you have a data type mismatch in one of your parameters.Terri Mort...

help me to transfer data from datagrid to sql server database....
Below is the code where datagrid is populated from Excel file... now i need know how to transfer the data from datagrid to sql server database????  string sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Server.MapPath("../ExcelData.xls") + ";" + "Extended Properties=Excel 8.0;"; OleDbConnection objConn = new OleDbConnection(sConnectionString); objConn.Open(); OleDbCommand objCmdSelect =new OleDbCommand("SELECT * FROM MyRange1 ", objConn); OleDbDataAdapter objAdapter1 = new OleDbDataAdapter(); OleDbCommandBuilder custCB = new OleDbCommandBuilder(objAd...

Web resources about - Transfer data from webform to sql database - asp.net.getting-started

Talk:Asynchronous Transfer Mode - Wikipedia, the free encyclopedia
This article is within the scope of WikiProject Computing , a collaborative effort to improve the coverage of computers , computing , and information ...

Inmate's transfer to isolated, poorly designed ward contributed to suicide
Transfer to isolated, poorly designed skill contributed to inmate suicide, coroner finds.

Barcelona Transfer News: Lionel Messi Holds 'Secret Talks' with Manchester City - Bleacher Report
Barcelona star Lionel Messi has reportedly been holding “secret talks” with Premier League giants Manchester City , if the latest rumours from ...

'Dance Moms' Season 6 Spoilers: Nia Frazier To Transfer To Debbie Allen's Studio?
Will Nia Frazier leave ALDC to join Debbie Allen's studio?

Facebook Threatened With Lawsuit Over EU-US Data Transfers; Facebook Response
Facebook, Inc. and related entities have received a letter demanding them to stop EU-US data transfers until U.S. laws comply with the EU data ...

PUSH TO EMPTY GITMO Report: WH plans biggest detainee transfer in years
PUSH TO EMPTY GITMO Report: WH plans biggest detainee transfer in years

Largest Gitmo transfer since 2007 is in the works
... that have housed suspected terrorists since it opened in 2002. Right now, the administration is on the verge of the largest detainee transfer ...

Cristiano Ronaldo Linked To Manchester City Transfer Again, City Players Confident Of Move
Cristiano Ronaldo has once again been linked to a transfer away from Real Madrid, and this time it has been alleged that Manchester City are ...

Surry County real property transfers
Surry County real property transfers Mount Airy News Byron and Robin Hooper and Michael and Rita Wiles to Jean N. Guyer. Tract in Elkin. $85. ...

Transfers Could Reduce Guantánamo Detainees to 90
... as 90 by mid- to late January. Defense Secretary Ashton B. Carter has notified Congress in recent days that he has approved 17 proposed transfers ...

Resources last updated: 12/22/2015 2:43:15 PM