please tell me how to fix the exception: "NullReferenceException: Object reference not set to an instance of an object". I'm trying to make a request, I wrote it like this:
public void conn()
{
path = Application.dataPath + "/StreamingAssets/db.bytes";
con_db = new SqliteConnection("URI=file:" + path);
con_db.Open();
if (con_db.State == ConnectionState.Open)
{
string nameP= Input.text.ToString();
dbcmd.Connection = con_db;
dbcmd = new SqliteCommand("Select Name from Player where Name=='" + nameP+ "'");
rdr = dbcmd.ExecuteReader();
if (rdr.HasRows & rdr != null)
{
while (rdr.Read())
{
string n = rdr[0].ToString();
if (n != "")
{
Debug.Log("data received");
}
else
{
Debug.Log("no data received");
}
}
}
}
else
{
Debug.Log("Connection error");
}
}
but in the Nick_db line.Connection = con_db; this exception occurs.