当我运行我的程序时,sql 命令到达 table.executenonquery 并停止,它加载程序界面并且没有其他任何事情发生?我查看了数据库,它没有添加我需要的表。这是我的代码:
private void loginForm_Load(object sender, EventArgs e)
{
string connectionString = "DataSource=\"Event Control.sdf\"";
SqlCeEngine en = new SqlCeEngine(connectionString);
en.CreateDatabase();
string createTable = "CREATE TABLE Login (userName nvarchar(50), Salt nvarchar(100), Hash nvarchar(100)";
string connection = "Data Source = Event Control.sdf";
SqlCeConnection connexion = new SqlCeConnection(connection);
SqlCeCommand table = new SqlCeCommand(createTable, connexion);
try
{
connexion.Open();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
table.ExecuteNonQuery();
connexion.Close();
}
它到达终点(table.ExecuteNonQuery)并停止。死的。仅供参考,我不确定它是执行非查询还是执行标量(不确定区别),但我都尝试过
多谢你们