I have designing in my web page
i have store the value in database ok but drop drown list value is not stored but i have select the first item. number 1 are stored ...and i have select the seventh item ...the number 7 are stored database The value not sored in a database how i change it
protected void btnSave_Click(object sender, EventArgs e)
{
Int32 st;
int len = browseFilepath.PostedFile.ContentLength;
byte[] pic = new byte[len];
browseFilepath.PostedFile.InputStream.Read(pic, 0, len);
SqlCommand Cmd = new SqlCommand();
SqlConnection Cnn = new SqlConnection();
string ConnectionString;
ConnectionString = ConfigurationManager.ConnectionStrings["PhotostudioConnectionString"].ConnectionString;
Cnn.ConnectionString = ConnectionString;
if (Cnn.State != ConnectionState.Open)
Cnn.Open();
Cmd.Connection = Cnn;
Cmd.CommandType = CommandType.StoredProcedure;
Cmd.CommandText = "sproc_Ins_PhotoSettingsDetailses";
Cmd.Parameters.Clear();
Cmd.Parameters.AddWithValue("@Name", txtCName.Text);
Cmd.Parameters.AddWithValue("@Phoneno", txtPhone.Text);
Cmd.Parameters.AddWithValue("@Startdate", rdStartDate.SelectedDate);
Cmd.Parameters.AddWithValue("@Enddate", rdEndDate.SelectedDate);
Cmd.Parameters.Add("@Systemurl", SqlDbType.Image).Value = pic;
SqlParameter Src = new SqlParameter("@FilePath", SqlDbType.NVarChar, 450);
Src.Value = browseFilepath.PostedFile.FileName;
Cmd.Parameters.Add(Src);
Cmd.Parameters.AddWithValue("@Size", cmbSize.SelectedValue );
Cmd.Parameters.AddWithValue("@Amount",txtAmt.Text);
Cmd.Parameters.AddWithValue("@Extracopies", txtNoofcopies.Text);
Cmd.Parameters.AddWithValue("@Examount",TextBox1.Text );
Cmd.Parameters.AddWithValue("@Lamination", Ddl.SelectedValue );
Cmd.Parameters.AddWithValue("@Laamount", txtlami.Text );
Cmd.Parameters.AddWithValue("@Total", txtTot.Text );
Cmd.Parameters.AddWithValue("@Grandtotal", txtgrandtot.Text );
Cmd.Parameters.AddWithValue("@Paidamount", txtPaid.Text);
Cmd.Parameters.AddWithValue("@Balance", txtbalance.Text );
try
{
st = Convert.ToInt32(Cmd.ExecuteScalar());
}
catch (Exception ex)
{
throw new ApplicationException(
"!!! An Error Occured While getting Data From Hdr_AccountType." + ex.Message);
lblError.Visible = true;
lblError.Text = "!!! An Error Occured While " + ex.Message.ToString();
return;
}
Cmd.Dispose();
My store procesure
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE
[dbo].[sproc_Ins_PhotoSettingsDetailses]
(
@Name as Varchar(100),
@Phoneno as Numeric(18,0),
@Startdate as datetime,
@Enddate as datetime,
@Systemurl as Image,
@FilePath as NVarchar(450),
@Size as nvarchar(50),
@Amount as numeric(18,0),
@Extracopies as numeric(18,0),
@Examount as numeric (18,0),
@Lamination as numeric(18,0),
@Laamount as numeric(18,0),
@Total as numeric(18,0),
@Grandtotal as numeric (18,0),
@Paidamount as Numeric(18,0),
@Balance as numeric (18,0)
)
AS
BEGIN
INSERT INTO tblMainPhotosettings
(
Name,
Phoneno,
Startdate,
Enddate,
Systemurl,
FilePath,
Size,
Amount,
Extracopies,
Examount,
Lamination,
Laamount,
Total,
Grandtotal,
Paidamount,
Balance
)
VALUES
(
@Name,
@Phoneno,
@Startdate,
@Enddate,
@Systemurl,
@FilePath,
@Size,
@Amount,
@Extracopies,
@Examount,
@Lamination,
@Laamount,
@Total,
@Grandtotal,
@Paidamount,
@Balance
)
Select @@Identity
END