首先,让我告诉你我检查了一堆“如何检查......中是否存在表”。不过,我需要有关查询的更多信息
\n\nSELECT name FROM sqlite_master WHERE type=\'table\' AND name=\'table_name\';\nRun Code Online (Sandbox Code Playgroud)\n\n我想我必须更改名称“sqlite_master”和“table_name”,这是我的代码
\n\n// a static function of the public class "SqliteBase"\npublic static void CreerBase(string dataSource)\n{\n SQLiteConnection connection = new SQLiteConnection();\n\n connection.ConnectionString = "Data Source=" + dataSource;\n connection.Open();\n SQLiteCommand command = new SQLiteCommand(connection);\n\n // Create table if it does not exist\n command.CommandText = "CREATE TABLE IF NOT EXISTS beispiel ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(100) NOT NULL);";\n Console.WriteLine("La Table a bien \xc3\xa9t\xc3\xa9 cr\xc3\xa9\xc3\xa9e");\n command.ExecuteNonQuery();\n command.Dispose();\n connection.Close();\n …Run Code Online (Sandbox Code Playgroud) 我收到以下错误:
"当前背景下不存在财产".
我检查了StackOverflow的常见原因,但我没有提出任何错误.(至少没有一个我理解^^).我正在使用Microsoft Visual Studio 2015
这是我的代码:
namespace ConsoleApplication5
{
public class Voiture
{
public int Vitesse { get; set; }
public Voiture()
{
Vitesse = 5;
}
public string Marque
{
get
{
throw new System.NotImplementedException();
}
set
{
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
在另一个文件中
namespace ConsoleApplication5
{
public class Audi : Voiture
{
public void Deraper()
{
Console.WriteLine("Vroooouum !!");
}
this.Marque = "Audi";
}
}
Run Code Online (Sandbox Code Playgroud)
如果不是this.Marque我使用Voiture.Marque,我会遇到同样的问题.如您所见,命名空间是可以的.怎么知道发生了什么?