0

喜んで助けてくれる人に別の質問があります。これはかなり簡単なはずですが、何らかの理由で正しく理解できないようです。Visual Studio 08 を使用して、C# で asp.net Web サイトを作成しています。

ユーザーを登録しようとしていますが、これはすべてうまく機能しており、新しいユーザーのデフォルトを管理者ではなくユーザーとして設定しています。すべてが保存される場所として .MDB を使用しています。

私の最初のSQLクエリでこれを行うことは可能ですか? 現在、私のコードは次のようになります

strSQL = "Insert into tblUserLogin " +
            "(UserFirstName, UserLastName, UserName, UserPassword, UserAddress, UserCity, UserState, UserZipCode, UserEmail, UserPhone, ) values ('" +
            UserFirstName + "', '" + UserLastName + "', '" + UserName + "', '" + UserPassword + "', '" + UserAddress +
            "', '" + UserCity + "', '" + UserState + "', '" + UserZipCode + "', '" + UserEmail + "', '" + UserPhone +
        "')";
    // set the command text of the command object
    command.CommandType = CommandType.Text;
    command.CommandText = strSQL;
    // Execute the insert statement
    command.ExecuteNonQuery();

これにより、すべてが .MDB に正常にポストされ、列 SecurityLevel の下のセルは空のままになります。

追加しようとしました

 "(UserFirstName, UserLastName, UserName, UserPassword, UserAddress, UserCity, UserState, UserZipCode, UserEmail, UserPhone, SecurityLevel=U )

しかし、これは私が望んでいたようには機能しませんでした。誰も指定しなくても、その値の SecurityLevel をデフォルトで U にする簡単な方法はありますか?

お時間をいただきありがとうございます

4

1 に答える 1