안녕하세요? 제가 디비 백업을 받지 못하고 소스만으로 디비를 구성해야 되는 상황에 있습니다.
다음 구문을 통해
Dim da1 As New OdbcDataAdapter("select c_charge, c_phone, c_email, c_name, c_tel, ZIPCODE, c_add,
Dim da1 As New OdbcDataAdapter("select c_charge, c_phone, c_email, c_name, c_tel, ZIPCODE, c_add,
s_number, e_number, e_charge, e_phone, c_date, c_pay, c_serial" + _
"from company where (c_code =" & code_NO & ")", myConnection)
"from company where (c_code =" & code_NO & ")", myConnection)
Dim da2 As New OdbcDataAdapter("select m.c_saluteTF as c_saluteTF, m.c_placeTF as c_placeTF,
m.c_holidayTF as c_holidayTF, m.c_businessTF as c_businessTF, m.c_salute1 as c_salute1,
m.c_salute2 as c_salute2, " + _ "m.c_place1 as c_place1, m.c_place2 as c_place2,
m.c_place3 as c_place3, m.c_place4 as c_place4, m.c_place5 as c_place5,
m.c_place6 as c_place6, m.c_place7 as c_place7, m.c_place8 as c_place8,
m.c_place9 as c_place9," + _ "m.c_holiday as c_holiday, m.c_lunch as c_lunch,
m.c_leaving as c_leaving, m.m_nurber as m_nurber, m.c_etc as c_etc " + _
"from company c JOIN ment m Using(c_code) where (c.c_code = " & code_NO & ")", myConnection)
"from company c JOIN ment m Using(c_code) where (c.c_code = " & code_NO & ")", myConnection)
Dim da As New OdbcDataAdapter("select c.c_code as c_code, c.c_name as c_name, c.c_charge as c_charge,
c.c_tel as c_tel, c.c_phone as c_phone, c.ZIPCODE as ZIPCODE, c.c_add as c_add,
c.c_email as c_email, s.s_name as s_name, c.c_date as c_date, " + _
"e.e_name as e_name, c.e_charge as e_charge, c.e_phone as e_phone, c.c_pay as c_pay" + _
" from company c JOIN service s Using(s_number) JOIN equipment e Using(e_number)
"e.e_name as e_name, c.e_charge as e_charge, c.e_phone as e_phone, c.c_pay as c_pay" + _
" from company c JOIN service s Using(s_number) JOIN equipment e Using(e_number)
order by c.c_code desc;", myConnection)
Dim da As New OdbcDataAdapter("select c.c_code as c_code, c.c_name as c_name, c.c_charge as c_charge,
c.c_tel as c_tel, c.c_phone as c_phone, c.ZIPCODE as ZIPCODE, c.c_add as c_add,
c.c_email as c_email, s.s_name as s_name, c.c_date as c_date, " + _
"e.e_name as e_name, c.e_charge as e_charge, c.e_phone as e_phone" + _
" from company c JOIN service s Using (s_number) JOIN equipment e Using(e_number) where
"e.e_name as e_name, c.e_charge as e_charge, c.e_phone as e_phone" + _
" from company c JOIN service s Using (s_number) JOIN equipment e Using(e_number) where
c.c_date between '" & lastweek & "%' and '" & tomorrow & "%'order by c.c_code desc;", myConnection)
Dim da As New OdbcDataAdapter("select c.c_code as c_code, c.c_name as c_name, c.c_charge as c_charge,
c.c_tel as c_tel, c.c_phone as c_phone, c.ZIPCODE as ZIPCODE, c.c_add as c_add,
c.c_email as c_email, s.s_name as s_name, c.c_date as c_date, " + _
"e.e_name as e_name, c.e_charge as e_charge, c.e_phone as e_phone" + _
" from company c JOIN service s Using (s_number) JOIN equipment e Using(e_number) where
"e.e_name as e_name, c.e_charge as e_charge, c.e_phone as e_phone" + _
" from company c JOIN service s Using (s_number) JOIN equipment e Using(e_number) where
c.c_date between '" & lastmonth & "%' and '" & tomorrow & "%'order by c.c_code desc;", myConnection)
Dim infoSql As String = "insert into company(c_charge,c_phone,c_email,c_name,c_tel,ZIPCODE,c_add,s_number,
e_number,e_charge,e_phone,c_date,c_pay) values ('" _
& charge & "','" & phone & "','" & email & "','" & company & "','" & tel & "','" & post & "',
& charge & "','" & phone & "','" & email & "','" & company & "','" & tel & "','" & post & "',
'" & add & "'," & model & "," & equipment & ",'" & e_charge & "','" & e_phone & "',SYSDATE(),false);"
Dim mentSql As String = "insert into ment values (" & code & ",'" & ment1_CHK & "','" & ment2_CHK & "',
'" & ment3_CHK & "','" & ment4_CHK & "','" & salute1 & "','" & salute2 & "','" _
& place1 & "','" & place2 & "','" & place3 & "','" & place4 & "','" & place5 & "','" & place6 & "',
& place1 & "','" & place2 & "','" & place3 & "','" & place4 & "','" & place5 & "','" & place6 & "',
'" & place7 & "','" & place8 & "','" & place9 & "','" _
& holiday & "','" & lunch & "','" & leaving & "'," & music & ",'" & etc & "');"
& holiday & "','" & lunch & "','" & leaving & "'," & music & ",'" & etc & "');"
아래와 같이 테이블을 구성하였습니다.
< company > 테이블
------------------------------------------------------------------------------------------------------------------
c_code c_charge c_phone c_email c_name c_tel ZIPCODE c_add s_number e_number e_charge e_phone c_date c_pay c_serial
----------------------------------------------------------------------------------------------------------------------
< ment > 테이블
--------------------------------------------------------------------------------------------------------------------
c_code c_saluteTF c_placeTF c_holidayTF c_businessTF c_salute1 c_salute2 c_place1 c_place2 c_place3 c_place4 c_place5 c_place6 c_place7 c_place8 c_place9 c_holiday c_lunch c_leaving m_nurber c_etc
----------------------------------------------------------------------------------------------------------------------
< service > 테이블
-----------------------------------------
s_number s_name
-----------------------------------------
< equipment > 테이블
-----------------------------------------
e_number e_name e_charge e_phone
-----------------------------------------
------------------------------------------------------------------------------------------------------------------
c_code c_charge c_phone c_email c_name c_tel ZIPCODE c_add s_number e_number e_charge e_phone c_date c_pay c_serial
----------------------------------------------------------------------------------------------------------------------
< ment > 테이블
--------------------------------------------------------------------------------------------------------------------
c_code c_saluteTF c_placeTF c_holidayTF c_businessTF c_salute1 c_salute2 c_place1 c_place2 c_place3 c_place4 c_place5 c_place6 c_place7 c_place8 c_place9 c_holiday c_lunch c_leaving m_nurber c_etc
----------------------------------------------------------------------------------------------------------------------
< service > 테이블
-----------------------------------------
s_number s_name
-----------------------------------------
< equipment > 테이블
-----------------------------------------
e_number e_name e_charge e_phone
-----------------------------------------
그러나 위 구문을 보면 Foreign key도 설정해 줘야 할것 같은데(JOIN을 사용하는 것으로 보아) 디비를 십 몇년만에 처음 접하다 보니 어렵네요.
물론 위 구문만으로는 어려울것으로(줄바꿈으로 인해 보기에도 어렵네요) 알지만 혹시나 하는 마음에
물론 위 구문만으로는 어려울것으로(줄바꿈으로 인해 보기에도 어렵네요) 알지만 혹시나 하는 마음에
위 테이블의 외부키를 어떻게 설정해야 되는지 도움을 청해도 될까요?
감사합니다.
¹®Á¦´Â µ¥ÀÌÅÍ ÇüÀº ÀüÇô ¾Ë ¼ö ¾øÀ¸´Ï... ¾î·Æ°Ú³×¿ä.
¹°·Ð µ¥ÀÌÅÍ Çü À̸§ ´Ù ³ª¿À´Ï °í¹Î ÇϽÃÁö ¸»°í È× µ¹·Á¼ Àâ¾Æ º¸½Ã°í ¿¬°á ½ÃÅ°½Ã¸é µÉ°Í °°½À´Ï´Ù¸¸.
DB ¹é¾÷º»À» ¸ø ¹ÞÀ¸½Ã´Â°Ô Á¢±ÙÀ» ÇÒ ¼ö °¡ ¾ø¾î¼ ÀÎÁö »çÁ¤À» Àß ¸ð¸¨´Ï´Ù¸¸.
Àú´Â PowerBuilder¸¦ ÁÖ·Î »ç¿ëÇÕ´Ï´Ù ÀÌ°Ç ÇÁ·Î±×·¥ °³¹ßµµ µÇÁö¸¸ »ì¦ DB µðÀÚÀ̳ʿ¡¼ °°´Ù ºÙÀÌ¸é º¸±â ÆíÇÏ°Ô ³ª¿Í¼ ¸»ÀÔ´Ï´Ù.