.mdb データベースを使用して asp.net プロジェクトでストアド プロシージャを実行する際に問題があります。ストアド プロシージャを使用したいのですが、実行コードの後...
using (OleDbConnection conn = new OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Database"].ConnectionString.ToString()))
{
conn.Open();
using (OleDbCommand com = new OleDbCommand("Insert", conn))
{
com.CommandType = CommandType.StoredProcedure;
com.Parameters.AddWithValue("@Login", UserName0.Text);
com.Parameters.AddWithValue("@Password", Hashing.Hash(ConfirmPassword0.Text));
com.Parameters.AddWithValue("@Role", RoleList1.SelectedValue);
com.ExecuteNonQuery();
}
conn.Close();
私は例外があります:
System.Data.OleDb.OleDbException: EXECUTE 後のクエリ名が必要です。
しかし、コードの下で使用すると、すべて問題ありません。私も変更しました: CommandType.StoredProcedure を CommandType.Text に変更しましたが、まだ機能しません。誰か助けてくれませんか?
using (OleDbConnection conn = new OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Database"].ConnectionString.ToString()))
{
conn.Open();
using (OleDbCommand com = new OleDbCommand("INSERT INTO Workers ( st_login, st_password, st_role ) VALUES (login, password, role);", conn))
{
com.Parameters.AddWithValue("@Login", UserName0.Text);
com.Parameters.AddWithValue("@Password", Hashing.Hash(ConfirmPassword0.Text));
com.Parameters.AddWithValue("@Role", RoleList1.SelectedValue);
com.ExecuteNonQuery();
}
conn.Close();