Document directory
- Database Analysis and selection
- C # sqlite database implementation
In the past few days, a simple drug Query form application has been developed for a hospital.
Database Analysis and selection
Excel files as data sources
Highly restrictive and not suitable for queries, analysis, and other operations
Access Database
Access Management data interface and functionality is not strong
Mysql and SQL server
Functions are met, but you need to install
Finally, select the sqlite database.
C # sqlite database implementation
Step one download the sqlite database. net access component and install
Http://sourceforge.net/projects/sqlite-dotnet2/
Step Two: Create a project and add sqlite Access Components and sqlite database files
Step Three create a link to access the database
public static DataTable GetAllBook() { DataTable dt = new DataTable(); try { SQLiteConnection conn = new SQLiteConnection("Data Source=db/Books.sqlite;"); conn.Open(); SQLiteCommand cmd = new SQLiteCommand(conn); cmd.CommandText = "SELECT * FROM Book"; cmd.CommandType = CommandType.Text; //Console.WriteLine(cmd.CommandText); SQLiteDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { dt.Load(dr); } else { //throw new NullReferenceException("No Record Available."); } dr.Close(); conn.Close(); } catch (ArgumentException ae) { MessageBox.Show(ae.Message + " \n\n" + ae.Source + "\n\n" + ae.StackTrace + "\n\n" + ae.Data); } catch (Exception ex) { //throw new Exception(ex.Message); MessageBox.Show(ex.Message + " \n\n" + ex.Source + "\n\n" + ex.StackTrace + "\n\n" + ex.Data); }