void Connection() { string strConnection = "Data Source=NSEZ-DD4-028;Initial Catalog=Insurance;Integrated Security= SSPI"; SqlConnection objConnection = new SqlConnection(strConnection); try { objConnection.Open(); SqlCommand command = new SqlCommand(); command.CommandText = "Select Claim_Type_Id from Claim_Type where Policy_Type_Id =" + Convert.ToString(drpClaimType.Text); SqlDataReader reader = command.ExecuteReader(); command.CommandText = "insert into Claims values ('" + txtSearchForCustomer.Text + "','" + Convert.ToString(txtPolicyNumber.Text) + "','" + txtDateOfLoss.Text + "','" + Convert.ToInt32(drpPolicyType.SelectedValue) + "','" + Convert.ToInt32(drpClaimType.SelectedValue) + "','" + txtAdditionalDetails.Text + "')"; command.Connection = objConnection; command.ExecuteNonQuery(); objConnection.Close(); } catch (Exception e) { // Label8.Text = ""; if (objConnection.State == ConnectionState.Open) { objConnection.Close(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)