async void ftest(object sender, EventArgs e) { // string[] lines = Globals.cSQLSERVER.Split(';'); // IMPORTEID.Text = lines[1] + "=" + lines[2] + "=" + lines[3]; Globals.cSQLSERVER = PARAGGELIES.ReadSQL("select EPO FROM MEM WHERE ID=1"); // DESKTOP-MPGU8SB\SQL17 // string constring = @"Data Source=" + Globals.cSQLSERVER + ";Initial Catalog=MERCURY;Uid=sa;Pwd=12345678"; // ";Initial Catalog=MERCURY;Uid=sa;Pwd=12345678"; string[] lines = Globals.cSQLSERVER.Split(';'); string constring = @"Data Source=" + lines[0] + ";Initial Catalog=" + lines[1] + ";Uid=sa;Pwd=" + lines[2]; // ";Initial Catalog=MERCURY;Uid=sa;Pwd=12345678"; // ok fine string constring = @"Data Source=DESKTOP-MPGU8SB\SQL17,51403;Initial Catalog=MERCURY;Uid=sa;Pwd=12345678"; // ok works fine string constring = @"Data Source=192.168.1.10,51403;Initial Catalog=MERCURY;Uid=sa;Pwd=12345678"; con = new SqlConnection(constring); try { con.Open(); await DisplayAlert("Συνδεθηκε", "οκ", "OK"); } catch (Exception ex) { await DisplayAlert("ΑΔΥΝΑΜΙΑ ΣΥΝΔΕΣΗΣ", ex.ToString(), "OK"); } }
public SUPER2() { InitializeComponent(); TITLOS.Text = PARAGGELIES.ReadSQL("select TITLOS FROM PARASTAT WHERE ID=1"); ARITMISI.Text = PARAGGELIES.ReadSQL("select ARITMISI FROM PARASTAT WHERE ID=1"); EIDOS.Text = PARAGGELIES.ReadSQL("select EIDOS FROM PARASTAT WHERE ID=1"); MainPage.ExecuteSqlite("UPDATE PARASTAT SET ARITMISI=0 WHERE ARITMISI=NULL "); }
public param1() { InitializeComponent(); Globals.cIP = PARAGGELIES.ReadSQL("select IP FROM MEM WHERE ID=1"); fakelos.Text = Globals.cIP; Globals.cSQLSERVER = PARAGGELIES.ReadSQL("select EPO FROM MEM WHERE ID=1"); sqlserver.Text = Globals.cSQLSERVER; Globals.cSQLSERVER = PARAGGELIES.ReadSQL("select DIE FROM MEM WHERE ID=1"); BARCODES.Text = Globals.useBarcodes; }
public static int StartSqlite(string Query) { // determine the path for the database file string dbPath = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.Personal), "adodemo.db3"); bool exists = File.Exists(dbPath); if (!exists) { Console.WriteLine("Creating database"); // Need to create the database before seeding it with some data Mono.Data.Sqlite.SqliteConnection.CreateFile(dbPath); } connection = new SqliteConnection("Data Source=" + dbPath); // Open the database connection and create table with data connection.Open(); var c = connection.CreateCommand(); Query = "CREATE TABLE IF NOT EXISTS MEM( ID INTEGER PRIMARY KEY,IP [nvarchar](45)," + "[EPO] [nvarchar](255) ," + "[DIE] [nvarchar](35) ," + "[POL] [nvarchar](35) ," + "[THL] [nvarchar](35) ," + "[AFM] [nvarchar](15) )"; c.CommandText = Query; var rowcount = c.ExecuteNonQuery(); // rowcount will be 1 string c2 = PARAGGELIES.ReadSQL("select CAST(count(*) AS VARCHAR(10) ) AS NN from MEM "); int n = Int32.Parse(c2); if (n == 0) { c.CommandText = "INSERT INTO MEM (IP) VALUES ('*')"; rowcount = c.ExecuteNonQuery(); // rowcount will be 1 } Globals.cIP = PARAGGELIES.ReadSQL("select IP from MEM where ID=1"); Globals.cSQLSERVER = PARAGGELIES.ReadSQL("select EPO from MEM where ID=1"); Globals.useBarcodes = PARAGGELIES.ReadSQL("select DIE from MEM where ID=1"); // l = MainPage.ExecuteSqlite(""); CAST(ARITMISI AS VARCHAR(10) ) return(rowcount); }
async void fkatax(object sender, EventArgs e) { string C = sqlserver.Text; C = C.Replace("/", "\\"); MainPage.ExecuteSqlite("update MEM SET EPO='" + C + "', IP='" + fakelos.Text + "' WHERE ID=1"); MainPage.ExecuteSqlite("update MEM SET DIE='" + BARCODES.Text + "' WHERE ID=1"); Globals.cSQLSERVER = PARAGGELIES.ReadSQL("select EPO FROM MEM WHERE ID=1"); Globals.cIP = PARAGGELIES.ReadSQL("select IP FROM MEM WHERE ID=1"); Globals.useBarcodes = PARAGGELIES.ReadSQL("select DIE FROM MEM WHERE ID=1"); }
async void fNEXT(object sender, EventArgs e) { if (nn < PARAGGELIES.NReadSQL("select count(*) from PARASTAT")) { nn = nn + 1; } TITLOS.Text = PARAGGELIES.ReadSQL("select ifnull(TITLOS,'') AS C FROM PARASTAT WHERE ID=" + nn.ToString()); ARITMISI.Text = PARAGGELIES.ReadSQL("select ARITMISI FROM PARASTAT WHERE ID=" + nn.ToString()); EIDOS.Text = PARAGGELIES.ReadSQL("select ifnull(EIDOS,'') AS C FROM PARASTAT WHERE ID=" + nn.ToString()); }
async void fPREV(object sender, EventArgs e) { if (nn > 1) { nn = nn - 1; } TITLOS.Text = PARAGGELIES.ReadSQL("select TITLOS FROM PARASTAT WHERE ID=" + nn.ToString()); ARITMISI.Text = PARAGGELIES.ReadSQL("select ARITMISI FROM PARASTAT WHERE ID=" + nn.ToString()); EIDOS.Text = PARAGGELIES.ReadSQL("select EIDOS FROM PARASTAT WHERE ID=" + nn.ToString()); }
async void FBRESPREV(object sender, EventArgs e) { if (nn >1) { nn = nn - 1; } PAR2.Text = PARAGGELIES.ReadSQL("select ifnull(TITLOS,'') AS C FROM PARASTAT WHERE ID=" + nn.ToString()); ATIM.Text = PARAGGELIES.ReadSQL("select ifnull(ARITMISI,0)+1 FROM PARASTAT WHERE ID=" + nn.ToString()); EIDOSPAR = PARAGGELIES.ReadSQL("select ifnull(EIDOS,'') AS C FROM PARASTAT WHERE ID=" + nn.ToString()); }
async void CreateTables(object sender, EventArgs e) { string c = "CREATE TABLE IF NOT EXISTS EID( ID INTEGER PRIMARY KEY,KOD [nvarchar](25)," + "[ONO] [nvarchar](255) ," + "[ENAL] [nvarchar](25) ," + "[YPOL] [real] ," + "[XONDR] [real] ," + "[DESM] [real] ," + "[ANAM] [real] ," + "[BARCODE] [nvarchar](15) ) "; MainPage.ExecuteSqlite(c); await DisplayAlert("ΕΙΔΗ ΟΚ", "ΕΙΔΗ ΔΗΜΙΟΥΡΓΗΘΗΚΑΝ", "OK"); // Κωδικός;Α.Φ.Μ.;Επωνυμία;Διεύθυνση;Πόλη;Τηλ.1 c = "CREATE TABLE IF NOT EXISTS PEL( ID INTEGER PRIMARY KEY,KOD [nvarchar](25)," + "[EPO] [nvarchar](255) ," + "[DIE] [nvarchar](35) ," + "[POL] [nvarchar](35) ," + "[THL] [nvarchar](35) ," + "[AFM] [nvarchar](15) )"; MainPage.ExecuteSqlite(c); // αν δεν υπαρχει το πεδιο "TYP" ΠΡΟΣΘΕΣΕ ΤΟ string nc = PARAGGELIES.ReadSQL("SELECT COUNT(*) AS CNTREC FROM pragma_table_info('PEL') WHERE name='TYP' "); if (Int16.Parse(nc) == 0) { MainPage.ExecuteSqlite("alter table PEL ADD TYP REAL"); MainPage.ExecuteSqlite("alter table PEL ADD DOY [varchar](20)"); MainPage.ExecuteSqlite("alter table PEL ADD PEK [INT] "); } await DisplayAlert("ΠΕΛΑΤΕΣ ΟΚ", "ΠΕΛΑΤΕΣ ΔΗΜΙΟΥΡΓΗΘΗΚΑΝ", "OK"); c = "CREATE TABLE IF NOT EXISTS EGGTIM (" + "[ATIM] [varchar](55)," + "[HME] [datetime] ," + "[IDPARAGG] [int] ," + "[KODE] [nvarchar](55) ," + "[POSO] [real] ," + "[TIMH] [real] ," + "[ONO] [varchar](55) ," + "[PROSUETA] [varchar](55) ," + "[CH1] [varchar](55) ," + "[CH2] [varchar](55) ," + "[NUM1] [int] ," + "[NUM2] [int] ," + "[ENERGOS] [int] ," + "[ID] INTEGER PRIMARY KEY )"; MainPage.ExecuteSqlite(c); // αν δεν υπαρχει το πεδιο "TYP" ΠΡΟΣΘΕΣΕ ΤΟ nc = PARAGGELIES.ReadSQL("SELECT COUNT(*) AS CNTREC FROM pragma_table_info('EGGTIM') WHERE name='EKPT' "); if (Int16.Parse(nc) == 0) { MainPage.ExecuteSqlite("alter table EGGTIM ADD EKPT REAL"); MainPage.ExecuteSqlite("alter table EGGTIM ADD KAU_AJ REAL"); MainPage.ExecuteSqlite("alter table EGGTIM ADD MIK_AJ REAL"); } c = "CREATE TABLE IF NOT EXISTS ARITMISI( ID INTEGER PRIMARY KEY,ARITMISI [int] )"; MainPage.ExecuteSqlite(c); MainPage.ExecuteSqlite("INSERT INTO ARITMISI (ARITMISI) VALUES (0)"); await DisplayAlert("ΑΡΙΘΜΗΣΗ ΟΚ", " ΔΗΜΙΟΥΡΓΗΘΗΚΑΝ", "OK"); c = "CREATE TABLE IF NOT EXISTS PARALABES( ID INTEGER PRIMARY KEY,ATIM [nvarchar](35),BARCODE [nvarchar](45) )"; MainPage.ExecuteSqlite(c); c = "CREATE TABLE IF NOT EXISTS BARCODES( ID INTEGER PRIMARY KEY,KOD [nvarchar](25),BARCODE [nvarchar](15) )"; MainPage.ExecuteSqlite(c); c = "CREATE TABLE IF NOT EXISTS MEM( ID INTEGER PRIMARY KEY,IP [nvarchar](45)," + "[EPO] [nvarchar](255) ," + "[DIE] [nvarchar](35) ," + "[POL] [nvarchar](35) ," + "[THL] [nvarchar](35) ," + "[AFM] [nvarchar](15) )"; MainPage.ExecuteSqlite("INSERT INTO MEM (IP) VALUES ('*')"); await DisplayAlert("ΑΡΙΘΜΗΣΗ ΟΚ", " ΔΗΜΙΟΥΡΓΗΘΗΚΑΝ", "OK"); MainPage.ExecuteSqlite(c); c = " CREATE TABLE IF NOT EXISTS TIMOKAT ( [KOD] [nvarchar](14) NOT NULL," + "[EKPT] [decimal](5, 2) NOT NULL, [TIMOK] [int] NOT NULL,[ONO] [nvarchar](35) NULL," + "[TIMOKPEL] [varchar](5) NULL,[TIMOKEID] [varchar](5) NULL, [TIMH] [decimal](18, 0) NULL," + "[TIMOKID] [int] NOT NULL) "; MainPage.ExecuteSqlite(c); c = "CREATE TABLE IF NOT EXISTS PARASTAT( ID INTEGER PRIMARY KEY,EIDOS [nvarchar](5)," + "[TITLOS] [nvarchar](30) ," + "[ARITMISI] [INT] ," + "[N1] [real] ," + "[N2] [real] ," + "[N3] [real] ," + "[C1] [nvarchar](15) ,[C2] [nvarchar](15) , [C3] [nvarchar](15) ) "; MainPage.ExecuteSqlite(c); if (PARAGGELIES.NReadSQL("select count(*) from PARASTAT") < 2) { MainPage.ExecuteSqlite("INSERT INTO PARASTAT (TITLOS,EIDOS) VALUES ('ΤΙΜΟΛΟΓΙΟ ΠΩΛΗΣΗΣ-Δ.Α.','T')"); MainPage.ExecuteSqlite("INSERT INTO PARASTAT (TITLOS,EIDOS) VALUES ('ΔΕΛΤΙΟ ΑΠΟΣΤΟΛΗΣ','A')"); } }
// SQLQUERYF async void SQLQUERYF(object sender, EventArgs e) { RESULTS.Text = PARAGGELIES.ReadSQL(QUERY.Text); }