Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using Microsoft.SPOT;
- using GHI.SQLite;
- public class Program
- {
- public static void Main()
- {
- Database myDatabase = new GHI.SQLite.Database();
- myDatabase.ExecuteNonQuery("CREATE Table tblGauges" +
- " (ID INTEGER, GaugeText TEXT, MaxValue INTEGER, MinValue INTEGER, UpdateRate INTEGER, Units TEXT, ARBFilter INTEGER)");
- //add rows to table
- myDatabase.ExecuteNonQuery("INSERT INTO tblGauges (ID, GaugeText, MaxValue, MinValue, UpdateRate, Units, ARBFilter)" +
- " VALUES (1,'RPM', 8000, 0, 25, 'RPM', 201)");
- myDatabase.ExecuteNonQuery("INSERT INTO tblGauges (ID, GaugeText, MaxValue, MinValue, UpdateRate, Units, ARBFilter)" +
- " VALUES (2,'TPS', 100, 0, 25, '%', 201)");
- myDatabase.ExecuteNonQuery("INSERT INTO tblGauges (ID, GaugeText, MaxValue, MinValue, UpdateRate, Units, ARBFilter)" +
- " VALUES (3,'ECT', 140, -40, 1000, 'oC', 1217)");
- // Process SQL query and save returned records in SQLiteDataTable
- ResultSet result = myDatabase.ExecuteQuery("SELECT * FROM tblGauges WHERE ID = 2");
- // Get a copy of table data example
- ArrayList tabledata = result.Data;
- object obj;
- String row = "";
- for (int j = 0; j < result.RowCount; j++)
- {
- row = j.ToString() + " ";
- for (int i = 0; i < result.ColumnCount; i++)
- {
- obj = result[j, i];
- if (obj == null)
- row += "N/A";
- else
- row += obj.ToString();
- row += " |";
- }
- Debug.Print(row);
- }
- myDatabase.Dispose();
- while (true) { }
- }
- }
- ---------------------------------------------
- OUTPUT:
- Key, ID, Text, Max, Min, Unit, ARBFilter (int)
- 0 2 |TPS |100 |0 |25 |% |201 |
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement