コード例 #1
0
        public bool insertPhysician(string id, string name, string speciality, string workhrs, string workdays, string number)
        {
            MySqlCommand command     = new MySqlCommand();
            String       insertQuery = "INSERT INTO `physician`(`Physician_id`, `Physician Name`, `Speciality`, `Working Hours`, `Working Days`, `Contact Number`) VALUES (@id,@nm,@speclty,@wrkhrs,@wrkdays,@num)";

            command.CommandText = insertQuery;
            command.Connection  = conn.getConnection();

            command.Parameters.Add("@id", MySqlDbType.VarChar).Value      = id;
            command.Parameters.Add("@nm", MySqlDbType.VarChar).Value      = name;
            command.Parameters.Add("@speclty", MySqlDbType.VarChar).Value = speciality;
            command.Parameters.Add("@wrkhrs", MySqlDbType.VarChar).Value  = workhrs;
            command.Parameters.Add("@wrkdays", MySqlDbType.VarChar).Value = workdays;
            command.Parameters.Add("@num", MySqlDbType.VarChar).Value     = number;

            conn.openConnection();

            if (command.ExecuteNonQuery() == 1)
            {
                conn.closeConnection();
                return(true);
            }
            else
            {
                conn.closeConnection();
                return(false);
            }
            //return true;
        }
コード例 #2
0
        public bool insertPatient(string id, string name, string age, string sex, string number, string address, string testsdone, string testres, string medicalhist, string reasonofassess, string allergies, string dob, string bloodgroup, string physician_id, string date, string ward_num, string time)
        {
            MySqlCommand command     = new MySqlCommand();
            String       insertQuery = "INSERT INTO `patients`(Patient_id, Patient_Name, Age, Sex, Contact_Number, Address, Tests_Done, Tests_Results, Medical_History, Reason_for_Assessment, Allergies, Date_Of_Birth, Blood_Group, Physician_id_fk, Date_Of_Visit, Ward_Numer, Time) VALUES( @id,@nm, @age,@sex, @num, @address, @tests, @res, @hist, @rsn, @alrg, @dob, @bldgrp, @doc, @date, @wrdnum, @time)";

            command.CommandText = insertQuery;
            command.Connection  = conn.getConnection();

            command.Parameters.Add("@id", MySqlDbType.VarChar).Value      = id;
            command.Parameters.Add("@nm", MySqlDbType.VarChar).Value      = name;
            command.Parameters.Add("@age", MySqlDbType.VarChar).Value     = age;
            command.Parameters.Add("@sex", MySqlDbType.VarChar).Value     = sex;
            command.Parameters.Add("@num", MySqlDbType.VarChar).Value     = number;
            command.Parameters.Add("@address", MySqlDbType.VarChar).Value = address;
            command.Parameters.Add("@tests", MySqlDbType.VarChar).Value   = testsdone;
            command.Parameters.Add("@res", MySqlDbType.VarChar).Value     = testres;
            command.Parameters.Add("@hist", MySqlDbType.VarChar).Value    = medicalhist;
            command.Parameters.Add("@rsn", MySqlDbType.VarChar).Value     = reasonofassess;
            command.Parameters.Add("@alrg", MySqlDbType.VarChar).Value    = allergies;
            command.Parameters.Add("@dob", MySqlDbType.VarChar).Value     = dob;
            command.Parameters.Add("@bldgrp", MySqlDbType.VarChar).Value  = bloodgroup;
            command.Parameters.Add("@doc", MySqlDbType.VarChar).Value     = physician_id;
            command.Parameters.Add("@date", MySqlDbType.VarChar).Value    = date;
            command.Parameters.Add("@wrdnum", MySqlDbType.VarChar).Value  = ward_num;
            command.Parameters.Add("@time", MySqlDbType.VarChar).Value    = time;

            conn.openConnection();

            if (command.ExecuteNonQuery() == 1)
            {
                conn.closeConnection();
                return(true);
            }
            else
            {
                conn.closeConnection();
                return(false);
            }
            //return true;
        }