私はこの方法を持っています:
public static int ExecuteNonQuery(ref DbCommand command, out string ErrorMessage)
{
ErrorMessage = String.Empty;
DbTransaction tran = null;
DbConnection conn = null;
int result = 0;
このメソッドは、別のページにアクセスするときに使用されます。クエリを渡す SQLcommand の形式でコマンドを渡しますが、これが何のためにあるのかわかりませんout string
。これは他人のコードですが、挿入クエリの抽象化の目的で使用したいと考えています。エラーメッセージパラメータは出力文字列であると言われているため、どのように取得すればよいですか。
私は自分のページの1つでこのようにしたい:
string Email = "example@example.com";
string Password = "Hello";
SqlCommand command = new SqlCommand("insert into J_example_Tbl(J_example_Email,J_example_Password) VALUES('"+Email+"','"+Password+"')");
PrimaryDBClass.ExecuteNonQuery(command, "Should I do like this");