public void onflbload(object sender, EventArgs e)
{
string filename=Server.MapPath("~\YourUploadFolder")+FileUpload.PostedFile.FileName;
FileUpload.PostedFile.SaveAs(filename);
SqlConnection connection = new SqlConnection();
connection.ConnectionString =@"Data Source=DEVI\SQLEXPRESS; Initial Catalog =cat; Integrated Security=SSPI";
try
{
connection.Open();
SqlCommand cmd = new SqlCommand("insert into tblphotosettings "
+ "(BillNo,CustomerName,Address,StartDate,EndDate,Systemurl,Numberofcopies,Amount,Total ) values (@BillNo,@CustomerName,@Address,@StartDate,@EndDate,@Systemurl,@Numberofcopies,@Amount,@Total)", connection);
cmd.Parameters.Add("@BillNo", SqlDbType.NVarChar).Value = TextBox1.Text;
cmd.Parameters.Add("@CustomerName", SqlDbType.NVarChar).Value = TextBox2.Text;
cmd.Parameters.Add("@Address", SqlDbType.NVarChar).Value = TextBox3.Text;
cmd.Parameters.Add("@StartDate", SqlDbType.NVarChar).Value = Rdbsdate.SelectedDate;
cmd.Parameters.Add("@EndDate", SqlDbType.NVarChar).Value = Rdbddate.SelectedDate;
cmd.Parameters.Add("@Systemurl", SqlDbType.VarChar).Value = filename;
cmd.Parameters.Add("@Numberofcopies", SqlDbType.NVarChar).Value = TextBox7.Text;
cmd.Parameters.Add("@Amount", SqlDbType.NVarChar).Value = TextBox8.Text;
cmd.Parameters.Add("@Total", SqlDbType.NVarChar).Value = TextBox9.Text;
cmd.ExecuteNonQuery();
}
finally
{
connection.Close();
}
}
Check whether the code works.