Exemple #1
0
        public DataTable search_by_name(Library_Software2 library2)
        {
            var           datatable = new DataTable();
            SqlConnection c         = new SqlConnection(constring);

            c.Open();
            SqlCommand com = new SqlCommand(query3, c);

            com.Parameters.AddWithValue("book_name", library2.book_name);
            SqlDataAdapter adapter = new SqlDataAdapter(com);

            adapter.Fill(datatable);
            return(datatable);
        }
Exemple #2
0
        public bool Add_books(Library_Software2 library2)
        {
            int           rows;
            SqlConnection c = new SqlConnection(constring);

            c.Open();
            SqlCommand com = new SqlCommand(query5, c);

            com.Parameters.AddWithValue("book_id", library2.book_Id);
            com.Parameters.AddWithValue("book_name", library2.book_name);
            com.Parameters.AddWithValue("student_id", library2.student_id);
            com.Parameters.AddWithValue("book_author", library2.book_author);
            rows = com.ExecuteNonQuery();
            c.Close();
            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }