제목 : [코드 샘플] Enterprise Library 6 : OutPut Parameter 사용
글번호:
|
|
340
|
작성자:
|
|
레드플러스
|
작성일:
|
|
2014/03/27 오전 2:52:00
|
조회수:
|
|
4146
|
protected void btnAddGroup_Click(object sender, EventArgs e)
{
Database db = (new DatabaseProviderFactory()).Create("ConnectionString");
DbCommand dbCommand = db.GetStoredProcCommand("AddNewGroup");
db.AddInParameter(dbCommand, "GroupUID", System.Data.DbType.String, txtGroupUID.Text);
db.AddInParameter(dbCommand, "Name", System.Data.DbType.String, txtName.Text);
db.AddInParameter(dbCommand, "Description", System.Data.DbType.String, txtDescription.Text);
db.AddOutParameter(dbCommand, "UID", System.Data.DbType.Int32, 8);
int result = db.ExecuteNonQuery(dbCommand);
if (result > 0)
{
Response.Redirect(Application["BOARD_GROUPVIEW_FILE"].ToString() + "?UID=" + db.GetParameterValue(dbCommand, "UID").ToString());
}
else
{
this.lblMessage.Text = "이미 존재하는 계정입니다.";
}
}