Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System.Data.SQLite;
- using System.Security.Cryptography;
- using System;
- public class GameMode : MonoBehaviour {
- private string user;
- private string pw;
- private string ip;
- private string db;
- private int port = 3306;
- private SQLiteConnection connection;
- private void Awake()
- {
- user = "root";
- pw = "";
- ip = "31.46.104.228";
- db = "test";
- string connectionString = string.Format("SERVER={0};DATABASE={1};UID={2};PASSWORD={3};PORT={4}",ip,db,user,pw,port);
- connection = new SQLiteConnection(connectionString);
- }
- void Start () {
- string sql = "SELECT * FROM testid";
- SQLiteCommand cmd = connection.CreateCommand();
- cmd.CommandText = sql;
- using (SQLiteDataReader reader = cmd.ExecuteReader())
- {
- while (reader.Read())
- {
- Console.WriteLine(reader[0]);
- }
- }
- }
- void Update () {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement