Ejemplo n.º 1
0
        public bool Update(string Table, String what, String where, Patient item = null)
        {
            OleDbParameter imgparam = new OleDbParameter();

            this.DbCommand.CommandText =
            "UPDATE " + Table +
            " SET " + what +
            " WHERE " +  where ;

            /*
            if (Table == "Patients")
            {

                imgparam = DbCommand.Parameters.AddWithValue("@Image", SqlDbType.Binary);
                imgparam.Value = item.Profileb;
                imgparam.Size = item.Profileb.Length;

            }
            */

            this.connect.Open();

            Console.WriteLine(this.DbCommand.CommandText);
            Console.WriteLine(this.DbCommand.Parameters.Count.ToString());
             this.DbCommand.ExecuteNonQuery();

            this.connect.Close();

            return true;
        }
Ejemplo n.º 2
0
        public void Insert(string Table, string[] Params, Patient item = null)
        {
            OleDbParameter imgparam = new OleDbParameter();

            DbCommand = connect.CreateCommand();
            DbCommand.CommandText =
               "INSERT INTO " + Table
                + " (" + Params[0] + ")" +
                " VALUES (" + Params[1] + ")";

            if (Table == "Patients")
            {

                imgparam = DbCommand.Parameters.AddWithValue("@Image", SqlDbType.Binary);
                imgparam.Value = item.Profileb;
                imgparam.Size = item.Profileb.Length;

            }

            DbCommand.Connection.Open();

            Console.Write(DbCommand.CommandText.ToString());

            int affected = DbCommand.ExecuteNonQuery();

            DbCommand.Connection.Close();
        }