- Home /
Database script doesn't edit database
Hi.
Trying to edit a database, but database doesn't change, when starting the script. Can somebody help to find an error?
Code:
string connectionString = "Data Source=file:Base123.db";
IDbConnection dbcon;
dbcon = (IDbConnection)new SqliteConnection(connectionString);
dbcon.Open();
sql = "INSERT INTO TheTable (UserName, Min) VALUES ('" + UserName + "'," + transform.localScale.x + ")";
IDbCommand dbcmd = dbcon.CreateCommand();
dbcmd.CommandText = sql;
dbcmd.ExecuteNonQuery();
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
dbcon = null;
P. S. Getting this error on start:
MissingMethodException: Method not found: 'System.Threading.Monitor.Enter'. Mono.Data.Sqlite.SqliteStatementHandle.ReleaseHandle () System.Runtime.InteropServices.CriticalHandle.Dispose (Boolean disposing) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Runtime.InteropServices/CriticalHandle.cs:56) System.Runtime.InteropServices.CriticalHandle.Dispose () (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Runtime.InteropServices/CriticalHandle.cs:42) Mono.Data.Sqlite.SqliteStatement.Dispose () Mono.Data.Sqlite.SqliteCommand.ClearCommands () Mono.Data.Sqlite.SqliteCommand.set_CommandText (System.String value) Mono.Data.Sqlite.SqliteConnection.Open () DataControls.Start () (at Assets/Scripts/DataControls.cs:22)
Answer by 3DCoder1234 · Feb 13, 2014 at 12:22 PM
The problem was solved by adding in Plugins directory this libraries (from C:\\Program Files\\Unity\\Editor\\Data\\Mono\\lib\\mono\\2.0\\
Mono.Data.Sqlite.dll
System.Configuration.dll
System.Data.dll
System.EnterpriseServices.dll
System.Security.dll
Your answer
![](https://koobas.hobune.stream/wayback/20220613133020im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
connect MSSQL in Unity,MSSQL in Unity 0 Answers
save load exp on database 2 Answers
How can i access a database in the web from unity iphone? 1 Answer
Access a MySQL database via C# ? 2 Answers