Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using Mono.Data.Sqlite;
  5. using System;
  6. using UnityEngine;
  7. using UnityEngine.UI;
  8.  
  9. public class LoginDB : MonoBehaviour {
  10.  
  11. public Text username;
  12. public Text password;
  13.  
  14. public void Enter() {
  15. string conn = "URI=file:" + Application.dataPath + "/Accounts.db"; //Path to database.
  16. IDbConnection dbconn;
  17. dbconn = (IDbConnection) new SqliteConnection(conn);
  18. dbconn.Open(); //Open connection to the database.
  19.  
  20. IDbCommand dbcmd = dbconn.CreateCommand();
  21. string sqlQuery = "SELECT 1 FROM accounts WHERE username ="+username+" AND password ="+password;
  22. dbcmd.CommandText = sqlQuery;
  23. IDataReader reader = dbcmd.ExecuteReader();
  24. reader.Close();
  25. reader = null;
  26. dbcmd.Dispose();
  27. dbcmd = null;
  28. dbconn.Close();
  29. dbconn = null;
  30. }
  31.  
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement