Пример #1
0
    public void Add_meeting(Meet_Info info)
    {
        con.Open();

        SqlCommand cmd = new SqlCommand("Add_meeting", con);

        cmd.CommandType = CommandType.StoredProcedure;
        SqlParameter p = new SqlParameter();

        //p = cmd.Parameters.Add("@date", SqlDbType.DateTime);
        //p.Value = info.Date;
        p       = cmd.Parameters.Add("@subject", SqlDbType.VarChar);
        p.Value = info.Subject;
        p       = cmd.Parameters.Add("@time", SqlDbType.VarChar);
        p.Value = info.Time;
        p       = cmd.Parameters.Add("@details", SqlDbType.VarChar);
        p.Value = info.Details;
        p       = cmd.Parameters.Add("@meeting_date", SqlDbType.DateTime);
        p.Value = info.Meeting_Date;
        //p = cmd.Parameters.Add("@status", SqlDbType.Int);
        //p.Value = info.Status;
        p       = cmd.Parameters.Add("@location", SqlDbType.VarChar);
        p.Value = info.Location;

        cmd.ExecuteNonQuery();

        con.Close();
    }
Пример #2
0
    public Meet_Info ViewMeet(int meet_id)
    {
        con.Open();

        SqlCommand cmd = new SqlCommand("ViewMeeting", con);

        cmd.CommandType = CommandType.StoredProcedure;

        SqlParameter p = new SqlParameter();

        p       = cmd.Parameters.Add("@meeting_no", SqlDbType.Int);
        p.Value = meet_id;

        SqlDataReader read   = cmd.ExecuteReader();
        Meet_Info     m_info = new Meet_Info();

        read.Read();
        if (read.HasRows)
        {
            m_info.Date         = DateTime.Parse(read["date"].ToString());
            m_info.Subject      = read["subject"].ToString();
            m_info.Time         = read["time"].ToString();
            m_info.Details      = read["details"].ToString();
            m_info.Meeting_Date = DateTime.Parse(read["meeting_date"].ToString());
            m_info.Status       = int.Parse(read["status"].ToString());
            m_info.Location     = read["location"].ToString();
        }
        else
        {
            m_info.Subject = "1000";//to show no such an entry.
        }
        read.Close();
        con.Close();
        return(m_info);
    }