Hi All. Complete noob here: What i’m trying to do is a simple registration screen where a text inputfields can be saved into an SQLite database. as you can see in the most of it are predefined strings as i am still testing it around. i have a script that should insert the values and it is attached to a button and calls the InsertScore function once it is clicked.
Anyway, why can’t i reference txtEmployeeID (the name of my Input Field) in C#? or better yet please show me how to reference the txtEmployeeID input field. that way i can get the string or the text inside it and save it into the database.
public void InsertScore()
{
connectionString = “URI=file:” + Application.dataPath + “/HighScoreDB.sqlite”;
using (SqliteConnection con = new SqliteConnection(connectionString))
{
SqliteCommand cmd = new SqliteCommand();
cmd.CommandText = @“INSERT INTO HighScores(EmployeeID, EmployeeFirstname, TestScore, ROLE) VALUES (@EmployeeID,@EmployeeFirstName,@TestScore, @ )”;
cmd.Connection = con;
//cmd.Parameters.Add(new SqliteParameter(“@EmployeeID”, “222222”));
//cmd.Parameters.Add(new SqliteParameter(“@EmployeeID”, gameObject.GetComponent
cmd.Parameters.Add(new SqliteParameter(“@EmployeeFirstName”, “Anand3”));
cmd.Parameters.Add(new SqliteParameter(“@TestScore”, “65”));
cmd.Parameters.Add(new SqliteParameter(" @ ", “Tester”));
con.Open();
cmd.ExecuteNonQuery();
}
}