I'm trying to get into my SQLite database in Xamarin.Forms project. But I have an issue with connection.Open() method., When I put the dot after my connection, I cannot see the Open() method in the opening list: and I get an error like that below:
Error CS1061 'SQLiteConnection' does not contain a definition for 'open' and no accessible extension method 'open' accepting a first argument of type 'SQLiteConnection' could be found (are you missing a using directive or an assembly reference?)
Here is my connection string:
if (!string.IsNullOrEmpty(player))
{
if (Regex.IsMatch(player, @"^[a-zA-Z0-9 ]+$"))
{
string connectionString = @"Data Source=C:\Users\altan\Desktop\DERSLER MESA CC\deneme\SQLitePhoneGame\phoneGameDB.db;Version=3;UseUTF16Encoding=True;";
using (SQLiteConnection connection = new SQLiteConnection(connectionString))
{
connection.open();
}
}
else
{
return;
}
}
Here is the picture of the instance:
PS: Please write down useful information, not what you are assuming. Don't copy and paste anything you saw on the web and other topics! I just need the exact information! I've already checked so many writings. Thank you
According to your image and what you posted, you are not using the Microsoft.Data.SQLite library, but SQLite.Net-PCL. The second doesn't have the Open method at all, connection is opened by using the constructor github code . So answering, your connection is already opened inside {} brackets.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.