Ejemplo n.º 1
0
        public bool addChoThueXe(String cmnd, String bienso, String loaixe, String hieuxe, MemoryStream pic, DateTime ngayhd, DateTime ngaygiaoxe, DateTime ngayhethanthue, double trigiahd)
        {
            SqlCommand command = new SqlCommand("Exec pro_ThemXeVaoDanhSachChoThue @bienso , @loaixe , @hieuxe, @hinhanh, @oid, @ngayhd, @ngayhieuluc, @ngayhethan, @trigiahd", mydb.getConnection);

            command.Parameters.Add("@bienso", SqlDbType.VarChar).Value   = bienso;
            command.Parameters.Add("@loaixe", SqlDbType.VarChar).Value   = loaixe;
            command.Parameters.Add("@hieuxe", SqlDbType.VarChar).Value   = hieuxe;
            command.Parameters.Add("@hinhanh", SqlDbType.Image).Value    = pic.ToArray();
            command.Parameters.Add("@oid", SqlDbType.VarChar).Value      = cmnd;
            command.Parameters.Add("@ngayhd", SqlDbType.Date).Value      = ngayhd;
            command.Parameters.Add("@ngayhieuluc", SqlDbType.Date).Value = ngaygiaoxe;
            command.Parameters.Add("@ngayhethan", SqlDbType.Date).Value  = ngayhethanthue;
            command.Parameters.Add("@trigiahd", SqlDbType.Money).Value   = trigiahd;
            mydb.openConnection();
            if (command.ExecuteNonQuery() == 1)
            {
                mydb.closeConnection();
                return(true);
            }
            else
            {
                mydb.closeConnection();
                return(false);
            }
        }
Ejemplo n.º 2
0
        public void ExecuteNonQuery(string query)
        {
            dbconn = new My_DB();

            using (SqlConnection conn = dbconn.getConnection)
            {
                dbconn.openConnection();

                SqlCommand command = new SqlCommand(query, conn);
                command.ExecuteNonQuery();
                dbconn.closeConnection();
            }
        }
Ejemplo n.º 3
0
        public void ExecuteNonQueryIncludeImage(string query, MemoryStream pic)
        {
            dbconn = new My_DB();

            using (SqlConnection conn = dbconn.getConnection)
            {
                dbconn.openConnection();

                SqlCommand command = new SqlCommand(query + " @img", conn);
                command.Parameters.Add("@img", SqlDbType.Image).Value = pic.ToArray();
                command.ExecuteNonQuery();
                dbconn.closeConnection();
            }
        }
Ejemplo n.º 4
0
        public DataTable ExecuteQuery(string query)
        {
            dbconn = new My_DB();

            DataTable dataTable = new DataTable();

            using (SqlConnection conn = dbconn.getConnection)
            {
                dbconn.openConnection();

                SqlCommand     command = new SqlCommand(query, conn);
                SqlDataAdapter adapter = new SqlDataAdapter(command);
                adapter.Fill(dataTable);

                dbconn.closeConnection();
            }
            return(dataTable);
        }
Ejemplo n.º 5
0
        public bool insertKhachHang(String cmnd, String fname, String lname)
        {
            SqlCommand command = new SqlCommand("exec pro_ThemKhachHang @cmnd, @fname, @lname", mydb.getConnection);

            command.Parameters.Add("@cmnd", SqlDbType.VarChar).Value   = cmnd;
            command.Parameters.Add("@fname", SqlDbType.NVarChar).Value = fname;
            command.Parameters.Add("@lname", SqlDbType.NVarChar).Value = lname;

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