David Fry

David Fry

  • NA
  • 1
  • 1.6k

MS Database Read, Write, Update

Dec 13 2012 2:14 PM
Write, Update, Read (MS Access DB)

How do I complete this code?
values & where_values are separated by a ','

 internal class Database
    {
        public bool Write(string table, string values)
        {
            try
            {
                Console.WriteLine("DB - Write: " + table + ", " + values);
                // Write to database - NOTE: No problem with input values


                // Successful
                return true;
            }
            catch
            {
                // Failed
                return false;
            }
        }


        public bool Update(string table, string where_values, string values, string write_field = "")
        {
            try
            {
                Console.WriteLine("DB - Update: " + table + ", " + where_values + ", " + write_field + ", " + values);
                // Edit database - NOTE: If write field specify, change that field only.


                // Successful
                return true;
            }
            catch
            {
                // Failed
                return false;
            }
        }


        public string Read(string table, string where_values, string field)
        {
            try
            {
                string result = "";
                Console.WriteLine("DB - Read: " + table + ", " + where_values + ", " + field);
                // Read database - NOTE: No Problem with Input Values


                // Successful
                return result;
            }
            catch
            {
                // Failed
                return "";
            }
        }