Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Gtk;
- using System.Configuration;
- using System.IO;
- using System.Reflection;
- using MySql.Data.MySqlClient;
- namespace EmployeeScreen
- {
- class MainClass
- {
- private static string connectionString = string.Empty;
- // private static string databaseName = string.Empty;
- private static MySql.Data.MySqlClient.MySqlConnection mysqlConn;
- public static void Main (string[] args)
- {
- try {
- //connection string
- connectionString = ConfigurationSettings.AppSettings["mysqlConnectionString"].ToString();
- //select table
- mysqlConn = new MySql.Data.MySqlClient.MySqlConnection();
- mysqlConn.ConnectionString = connectionString;
- mysqlConn.Open();
- //Create the sql script...
- string createdbSql = "Select count(EmpID) from LocalDb.EmployeeDb";
- using (MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand (createdbSql, mysqlConn)) {
- cmd.ExecuteNonQuery ();
- Console.WriteLine ("Employee Count");
- }
- //window
- Application.Init ();
- MainWindow win = new MainWindow ();
- win.Show ();
- Application.Run ();
- } catch (Exception ex) {
- Console.WriteLine (ex.Message.ToString ());
- } finally {
- if (mysqlConn != null) {
- mysqlConn.Close ();
- mysqlConn.Dispose ();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement