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 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. the insert function works, it's just that i need to get the store the text from input field to a variable now or directly reference it here: cmd.Parameters.Add(new SqliteParameter("@EmployeeID",
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,@Role)";
cmd.Connection = con;
//cmd.Parameters.Add(new SqliteParameter("@EmployeeID", "222222"));
//cmd.Parameters.Add(new SqliteParameter("@EmployeeID", gameObject.GetComponent<input>
cmd.Parameters.Add(new SqliteParameter("@EmployeeFirstName", "Anand3"));
cmd.Parameters.Add(new SqliteParameter("@TestScore", "65"));
cmd.Parameters.Add(new SqliteParameter("@Role", "Tester"));
con.Open();
cmd.ExecuteNonQuery();
}
}