Beispiel #1
0
 public static void UpdateData(IJPDetails objEmployee, int Id) //Update data in database
 {
     using (var con = new SqlConnection(Constr))
     {
         var query = @" UPDATE [dbo].[IJPDetails] SET [Job] = '" + objEmployee.Job + "',[Experience] = '" + objEmployee.Experience + "',[LastDate] = '" + objEmployee.LastDate + "',[ApplicationReceived] = '" + objEmployee.ApplicationReceived + "',[Quantity] = '" + objEmployee.Quantity + "',[IJPStatus] = '" + objEmployee.IJPStatus + "'WHERE Id='" + Id + "'";
         con.Open();
         var cmd = new SqlCommand(query, con);
         cmd.ExecuteNonQuery();
         con.Close();
     }
 }
Beispiel #2
0
 public static void SaveUser(IJPDetails objEmployee) //Insert data in database
 {
     using (var con = new SqlConnection(Constr))
     {
         using (var cmd = new SqlCommand("INSERT INTO [dbo].[IJPDetails] VALUES(@Job,@Experience,@LastDate,@ApplicationReceived,@Quantity,@IJPStatus)"))
         {
             cmd.CommandType = CommandType.Text;
             cmd.Parameters.AddWithValue("@Job", objEmployee.Job);
             cmd.Parameters.AddWithValue("@Experience", objEmployee.Experience);
             cmd.Parameters.AddWithValue("@LastDate", objEmployee.LastDate);
             cmd.Parameters.AddWithValue("@ApplicationReceived", objEmployee.ApplicationReceived);
             cmd.Parameters.AddWithValue("@Quantity", objEmployee.Quantity);
             cmd.Parameters.AddWithValue("@IJPStatus", objEmployee.IJPStatus);
             cmd.Connection = con;
             con.Open();
             cmd.ExecuteNonQuery();
             con.Close();
         }
     }
 }