1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
private OleDbDataReader rd; private OleDbConnection Conn; private string strRet; private OleDbCommand cmd; private StringBuilder sbSQL; private OleDbParameter paramnSeq; try { // SQLOLEDB MSDAORA Conn = new OleDbConnection("Provider=MSDAORA;Data Source=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.xxx )(PORT = 1521)))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = GROUP))); User Id =; Password =;"); Conn.Open(); try { sbSQL = new StringBuilder(); sbSQL.Append(" SELECT * "); sbSQL.Append(" FROM HEIS_CUSTOMER "); sbSQL.Append(" WHERE 1=1 "); sbSQL.Append(" AND CUSTOMER_CODE = ? "); paramnSeq = new OleDbParameter("CUSTOMER_CODE", OleDbType.Char, 4); paramnSeq.Value = "0003"; cmd = new OleDbCommand(sbSQL.ToString(), Conn); cmd.Parameters.Add(paramnSeq); rd = cmd.ExecuteReader(); if (rd.Read()) { strRet = rd["CUSTOMER_CODE"].ToString(); } else { strRet = ""; } } catch (System.Exception e1) { throw e1; } finally { rd.Close(); } } catch (System.Exception e2) { throw e2; } finally { Conn.Close(); } |