Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using Mono.Data.Sqlite;
- using System;
- using UnityEngine;
- using UnityEngine.UI;
- public class LoginDB : MonoBehaviour {
- public Text username;
- public Text password;
- public void Enter() {
- string conn = "URI=file:" + Application.dataPath + "/Accounts.db"; //Path to database.
- IDbConnection dbconn;
- dbconn = (IDbConnection) new SqliteConnection(conn);
- dbconn.Open(); //Open connection to the database.
- IDbCommand dbcmd = dbconn.CreateCommand();
- string sqlQuery = "SELECT 1 FROM accounts WHERE username ="+username+" AND password ="+password;
- dbcmd.CommandText = sqlQuery;
- IDataReader reader = dbcmd.ExecuteReader();
- reader.Close();
- reader = null;
- dbcmd.Dispose();
- dbcmd = null;
- dbconn.Close();
- dbconn = null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement