You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
stringsql="select mycolumn from mytable where ID = @id";using(varcmd=newSqliteCommand(sql,myDbConnection)){cmd.Parameters.Add(newSqliteParameter("@id",mycolumnid));myDbConnection.Open();//may need to check and see if it is closed firstvarvalue1=cmd.ExecuteScalar();varvalue2=cmd.ExecuteScalar();//this one fails}
This appears to happen because the library tries to re-bind the parameters onto an existing SQLite statement (?); instead of creating a new SQLite statement (or before creating the second SQLite statement). So, SQLitePCL complains that binding is occurring out of order.
Current workaround:
Don't re-execute the same command. Instead, do this:
stringsql="select mycolumn from mytable where ID = @id";using(varcmd1=newSqliteCommand(sql,myDbConnection)){cmd1.Parameters.Add(newSqliteParameter("@id",mycolumnid));myDbConnection.Open();//may need to check and see if it is closed firstvarvalue1=cmd1.ExecuteScalar();}using(varcmd2=newSqliteCommand(sql,myDbConnection)){cmd2.Parameters.Add(newSqliteParameter("@id",mycolumnid));myDbConnection.Open();//may need to check and see if it is closed firstvarvalue2=cmd2.ExecuteScalar();}
There is probably a way to Reset the SQLite statement so that, behind the scenes, the whole SQLite process is happening over again. Will investigate.
The text was updated successfully, but these errors were encountered:
The following code fails:
This appears to happen because the library tries to re-bind the parameters onto an existing SQLite statement (?); instead of creating a new SQLite statement (or before creating the second SQLite statement). So, SQLitePCL complains that binding is occurring out of order.
Current workaround:
Don't re-execute the same command. Instead, do this:
There is probably a way to Reset the SQLite statement so that, behind the scenes, the whole SQLite process is happening over again. Will investigate.
The text was updated successfully, but these errors were encountered: