What is missing?

Apr 13 2004 11:54 AM
I have a webform that has four text box inputs and a button for inserting data into a database. See below:
 Please input demographic data.
 First Name:  
 Last Name:  
 Employee Number:  
 Email:  
 Phone Number:  
 
Here is the code behind: using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Text; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace TimeSheet1 { /// /// Summary description for Profile. /// public class Profile : System.Web.UI.Page { protected System.Web.UI.WebControls.TextBox F_Name; protected System.Web.UI.WebControls.TextBox L_Name; protected System.Web.UI.WebControls.TextBox Emp_Num; protected System.Web.UI.WebControls.TextBox Email; protected System.Web.UI.WebControls.TextBox Phone; protected System.Web.UI.WebControls.Button Add_Profile; private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here } public void AddProfile_Click(Object sender, EventArgs E) { SqlConnection sqlConn = new SqlConnection("server=C099450d01;uid=sa;pwd=;database=WebTimeSheet"); sqlConn.Open(); SqlCommand com = new SqlCommand("InsertProfile",sqlConn); com.CommandType = CommandType.StoredProcedure; com.ExecuteNonQuery(); sqlConn.Close(); } #region Web Form Designer generated code } } As you can see the code behind page is callng a stored procedure to insert data into the Profile table: Here is the stored procedure: ALTER PROCEDURE dbo.InsertProfile ( @F_Name [varchar] (100), @L_Name [varchar] (100), @Emp_Num [numeric] (9), @Email [varchar] (250), @Phone [nvarchar] (12) ) AS Insert into [Profile] ( [F_Name], [L_Name], [Emp_Num], [Email], [Phone] ) Values (@F_Name, @L_Name, @Emp_Num, @Email, @Phone) The problem is that when I submitt the form, I get an error indicating that there is no value for @F_Name. It would appear to me that the values from the form are not making it to the stored procedure. Can anyone help me with what code is missing to complete this action? Thank you. Sincerely, Tim P.S. Sorry for the long post. This forum should really incoporate formating for code blocks.

Answers (1)