// UserID를 이용하여 정보를 얻어내는 함수
private void InitPatientInfo(string strUserID)
{
string strConn = "Provider=MSDAORA.1;User ID=eric;password=eric1212;Data Source=wslee;Persist Security Info=False";
DataTable dt = new DataTable();
OleDbConnection conn = new OleDbConnection(strConn);
conn.Open();
string strQuery = "SELECT REGISTER_DTTM, "
+ "USER_ID, "
+ "USER_NAME, "
+ "SPECIAL_NEEDS, "
+ "USER_BIRTH_DTTM, "
+ "USER_SEX, "
+ "SCHEDULED_PROC_ID, "
+ "SCHEDULED_PROC_DESC "
+ "FROM USER_INFO "
+ "WHERE USER_ID = ? "
+ "ORDER BY ACCESSION_NO";
OleDbCommand comm = new OleDbCommand(strQuery, conn);
comm.Parameters.Add("@p1", OleDbType.VarChar).Value = strUserID;
OleDbDataAdapter da = new OleDbDataAdapter(comm);
try
{
da.Fill(dt);
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
dt.Dispose();
comm.Dispose();
conn.Close();
}
textBoxReceiveDate.Text = dt.Rows[0]["REGISTER_DTTM"].ToString(); // 접수일자
textBoxSocialNumber.Text = dt.Rows[0]["USER_ID"].ToString(); // User id
textBoxPatientName.Text = dt.Rows[0]["USER_NAME"].ToString(); // User name
textBoxExamClassification.Text = dt.Rows[0]["SPECIAL_NEEDS"].ToString(); // 구분
textBoxBirthDate.Text = dt.Rows[0]["USER_BIRTH_DTTM"].ToString(); // 생년월일
textBoxSex.Text = dt.Rows[0]["USER_SEX"].ToString(); // 성별
}
///----------------------------------------------------------------------------------
변수는 '?'가 받으며 순서대로 bind됨
//------------------------------------------------------------------------
야휴 블로그에서 옮겨온 data입니다.

0 개의 댓글:
댓글 쓰기