Ejemplo n.º 1
0
        public static int UpdateSupplier(string SupName)  // Update the data in ShippedDate field
        {
            SqlConnection connection = TravelExperts.GetConnection();
            int           ireturn    = 0;

            {
                try

                {
                    string sql = " UPDATE Suppliers SET SupplierId =@SupplierId , SupName=@SupName";
                    //where OrderID='OrderID'";
                    //"WHERE RequiredDate > ShippedDate AND ShippedDate < OrderDate";
                    SqlCommand command = new SqlCommand(sql, connection);

                    //command.Parameters.AddWithValue("@SupplierId",SupplierId);
                    command.Parameters.AddWithValue("@SupName", SupName);


                    ireturn = command.ExecuteNonQuery();
                }

                catch (Exception e)
                { }

                finally
                {
                    connection.Close();
                }
            }
            return(ireturn);
        }
Ejemplo n.º 2
0
        public static Suppliers GetSuppliersDB()
        {
            SqlConnection connection = TravelExperts.GetConnection();
            Suppliers     S          = new Suppliers();

            try

            {
                string sql = " Select * from Suppliers";

                SqlCommand command = new SqlCommand(sql, connection);
                command.Parameters.AddWithValue("@SupplierId", S);
                command.Parameters.AddWithValue("@SupName", S);
                SqlDataReader reader = command.ExecuteReader(System.Data.CommandBehavior.CloseConnection);

                while (reader.Read())
                {
                    S.SupplierId = Convert.ToInt32(reader["SupplierId"]);
                    S.SupName    = Convert.ToString(reader["SupName"]);

                    // reader.Add(S);
                }
            }

            catch (Exception e)
            { }
            finally
            {
                connection.Close();
            }

            return(S);
        }
Ejemplo n.º 3
0
        public static List <Suppliers> GetSuppliersGridDB()  // Prepares the dta for Grid View

        {
            SqlConnection    connection = TravelExperts.GetConnection();
            Suppliers        S;
            List <Suppliers> lstSuppliers = new List <Suppliers>();

            try

            {
                string sql = " Select * from Suppliers";

                SqlCommand command = new SqlCommand(sql, connection);

                SqlDataReader reader = command.ExecuteReader(System.Data.CommandBehavior.CloseConnection);

                while (reader.Read())
                {
                    S = new Suppliers();

                    S.SupplierId = Convert.ToInt32(reader["SupplierId"]);
                    S.SupName    = Convert.ToString(reader["SupName"]);

                    // reader.Add(O);

                    lstSuppliers.Add(S);
                }
            }

            catch (Exception e)
            { }
            finally
            {
                connection.Close();
            }

            return(lstSuppliers);
        }