Codes
Codes
Codes
Connection = cn; cmd.CommandText = "select C_ID from dbo.tab_courseSchedule group by C_ID HAVING C_ID LIKE 'IC%'"; SqlDataReader dread = cmd.ExecuteReader(); while (dread.Read()) { ddl_Cno.Items.Add(dread["C_ID"].ToString()); } dread.Close();
#region catch //foreign key exception catch (InvalidOperationException ) { ShowAlertMessage("Invalid Operation Performed!!"); } //primary Key exception catch(DuplicateNameException) { ShowAlertMessage("Record Already Exists !!"); } catch(ConstraintException) { ShowAlertMessage("Constraint Violated !!"); } catch (System.Web.HttpException)
ShowAlertMessage("A Web Exception occurred!!"); } catch (IndexOutOfRangeException) { ShowAlertMessage("Index Out Of Bounds Error!!"); } catch (FormatException) { ShowAlertMessage("Incorrect Data Format!!"); } catch (OverflowException) { ShowAlertMessage("Length of Data Exceeds!!"); } catch (NullReferenceException) { ShowAlertMessage("Null Reference Error !!"); } catch (StackOverflowException) { ShowAlertMessage("StackOverflow Error!!"); } catch(ArgumentException) { ShowAlertMessage("Illegal Argument Error!!"); } catch(DataException) { ShowAlertMessage("Data Access Error!!"); } catch (Exception) { ShowAlertMessage("Error!!"); } #endregion finally { cn.Close(); } }