static void Main(string[] args) { string errMsg = db.Query("Select * from xstudents"); if (errMsg != null) { Console.WriteLine("Error: " + errMsg); } }
//------------------------------------------------ static bool DB_Query(xRemoteDB db, string query) { //Console.WriteLine("DB_Query: " + query); string err_msg = db.Query(query); if (err_msg != null) { Console.WriteLine(err_msg + "\n" + query); return false; } return true; }
static bool Do_Query(string query) { string error_msg = db.Query(query); if (error_msg != null) { MessageBox.Show(query + "\n\n" + error_msg, "SQL Error"); return(false); } Console.WriteLine("\n" + query); if (db.HasRows) { Console.WriteLine("=========================================================="); for (int i = 0; i < db.FieldCount; i++) { Console.Write(db.GetName(i) + "\t"); } Console.WriteLine(); Console.WriteLine("=========================================================="); for (int n = 0; n < db.RowCount; n++) { for (int i = 0; i < db.FieldCount; i++) { string str = db.GetData(db.GetName(i), n).ToString(); Console.Write(str + "\t"); } Console.WriteLine(); } Console.WriteLine("==========================================================\n"); } return(true); }