开发者

Data is not inserting in the database

I am creating a wbsite and I have the following code in c#.net

public void btnSubmit_Click(TextBox txtEmailAdd, TextBox txtFirstName, TextBox txtLastName, TextBox txtDob, Dro开发者_高级运维pDownList drpdwnState, TextBox txtZipCode, DropDownList drpdwnCountry, Label lblMsg)
    {
        string[] ParameterName = { "@EmailId", "@FirstName", "@LastName", "@DOB", "@State", "@PostalCode", "@Country"};
        ArrayList ParameterValue = new ArrayList();
        ParameterValue.Add(Convert.ToString(txtEmailAdd.Text));
        ParameterValue.Add(Convert.ToString(txtFirstName.Text));
        ParameterValue.Add(Convert.ToString(txtLastName.Text));
        ParameterValue.Add(Convert.ToString(txtDob.Text));       
        ParameterValue.Add(Convert.ToString(drpdwnState.SelectedItem.Text));
        ParameterValue.Add(Convert.ToString(txtZipCode.Text));
        ParameterValue.Add(Convert.ToString(drpdwnCountry.SelectedItem.Text));

        int i = objDataAccess.Insert_Update_DeleteRecord("[WaterKingdom].[Master].[usp_EmailForm_Insert]", CommandType.StoredProcedure, ParameterName, ParameterValue);

            lblMsg.Text = "Thanks for sending mail.";

    }

and I am using the following stored procedure:

ALTER PROCEDURE [Master].[usp_EmailForm_Insert]
@EmailId varchar(50),
@FirstName varchar(50),
@LastName varchar(50),
@DOB varchar(50),
@State varchar(50),
@PostalCode varchar(50),
@Country varchar(50)
AS
BEGIN
INSERT INTO [Master].[EmailForm]
(EmailId,FirstName,LastName,DOB,State,PostalCode,Country)
VALUES
 (@EmailId,@FirstName,@LastName,@DOB,@State,@PostalCode,@Country)
END

still the data is not storing in the database.where is the fault Please help me. Thanks in advance.


Use sqlprofiler, observe traces, you will be able to see what query dbms receives. but please use try catch first.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜