AuthorQuestion
MS Database Read, Write, Update
Posted on: 13 Dec 2012
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 "";
            }
        }


[ + ]
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Get Career Advice from Experts