这里我使用的是 sqlite 数据库。代码在这里:
using (SQLiteCommand cmd = new SQLiteCommand(query, conn))
{
conn.Open();
cmd.ExecuteNonQuery();
cmd.CommandText =
"insert into users(name, password, priviledges) values(" +
"'" + UsernameText.Text.Trim() + "', " + "'" +
QuickMethods.MD5(PasswordText.Password.Trim()) + "', " + "524287" + ")";
cmd.ExecuteNonQuery();
cmd.CommandText = "INSERT INTO company VALUES('name','" + CompanyName.Text.Trim() + "');";
cmd.ExecuteNonQuery();
cmd.CommandText = "INSERT INTO company VALUES('address','" + CompanyAddress.Text.Trim() + "');";
cmd.ExecuteNonQuery();
cmd.CommandText = "INSERT INTO company VALUES('phone','" + CompanyPhone.Text.Trim() + "');";
cmd.ExecuteNonQuery();
cmd.CommandText = "INSERT INTO company VALUES('email','" + CompanyEmail.Text.Trim() + "');";
cmd.ExecuteNonQuery();
conn.Close();
}
我在cmd.ExecuteNonQuery()行遇到异常,如何解决它。