| Oracle |
Calling Oracle's SP with the wrong command type will result in error or a very long wait.
When ASPdb is accessing a database with
system privileges like system/manager, you must specify the table owner. For
example:
X.dbDSN
= "DSN=Oracle; uid=system; pwd=manager"
X.dbSQL=”SELECT
* FROM DEMO.CUSTOMER”
If dbSelectBox is used
then the allowable Table Owner(s) can be specified in the 4th
parameter of the dbTables property. For example if you log in as
userid/password = Scott/Tiger, the table owner should be SCOTT, the Microsoft
ODBC driver will return all the tables owned by both DEMO and SCOTT.
To compensate for this and only show SCOTT’s tables, use this parameter
to limit the “Allowable” owner to SCOTT:
X.dbTables=”SelectBoxSize, SelectBoxTitle, SelectBoxButton, SCOTT”
The delimiter of this
parameter is “+”. For example,
X.dbTables=”SelectBoxSize, SelectBoxTitle,
SelectBoxButton, SCOTT+DEMO”
Similarly,
specify the tablename in the edit parameters as owner.table. For example:
X.dbEditParams = "TableName=DEMO.CUSTOMER, TableTag=border=1,
BookMarkFlds=0"
If
you are using the dbQuickProps property, make sure you change the default Group
delimiter because the DSN contains (;). For example:
X.dbQuickProps="(/,)1/DSN=Oracle805;
uid=scott; pwd=tiger/ customer/ dual-horiz/ 4,auto/ std/ image_dir/ Oracle"

| Example |
Updating Scott/Tiger's EMP DB HIREDATE with Date containing HH:MM:SS
| <% Set X = Server.CreateObject("ASP.DB") X.dbDSN="DSN=Ora805; UID=scott; PWD=tiger" X.dbDbType="Oracle" 'This declaration is important. X.dbUnit = 1 X.DbMode = "Grid" X.dbSQL = "($~)SELECT EMP.EMPNO, EMP.ENAME, EMP.JOB, EMP.MGR, " &_ "EMP.HIREDATE, " &_ "EMP.SAL, EMP.COMM, EMP.DEPTNO FROM EMP ORDER BY EMP.EMPNO" X.dbNavigationItem="top, bottom, next, prev, update" X.dbMagicCell="4,,Format=[mm/dd/yyyy hh:mm:ss];" 'X.dbOptions="(;~)DateFormat=TO_DATE('[DD-MMM-YYYY HH:MM:SS]','DD-MON-YYYY HH24:MI:SS')" 'This is default for Oracle. No need to put it in. Just define dbDBType="Oracle". X.dbEditParams="TableName=SCOTT.EMP,BookMarkFlds=0,TableTag=BORDER=2," X.dbEditFlds="1,2,3,4,5,6,7" X.dbDebug=101 'debug the Edit SQL statement X.ASPDB %> |
Free format MS type date can be entered in the Edit Screen. Note that the date on screen (11/12/79 11:15:30PM) is formatted according to the format string inside the [...] tag which is (DD-MMM-YYYY HH:MM:SS). The entire DateFormat string is then submitted to the Edit SQL statement. Debug 101 will reveal that the Edit Update SQL is - Edit SQL=UPDATE SCOTT.EMP SET ENAME = 'SMITH', JOB = 'CLERK', MGR = 7902 , HIREDATE = TO_DATE('12-Oct-1979 23:15:35','DD-MON-YYYY HH24:MI:SS'), SAL = 800 , COMM = Null , DEPTNO = 20 WHERE EMPNO = 7369
|
| Oracle datatype program |
Use this program to check Oracle's datatype
|
<% Set oConn = Server.CreateObject("ADODB.Connection") Set oRs = Server.CreateObject("ADODB.Recordset") connStr = "Driver={Oracle ODBC Driver}; Server=YourServer; UID=system; PWD=manager" oConn.Open connStr oRs.Open "SELECT * FROM YourOracleTable", oConn, 1, 1, 1 response.write ("<h3><center>DataType Check Utility <br>") response.write("<table cellspacing='0' cellpadding='2' rules='all' bordercolor='#000000' border='1' style='background-color: #FFFFFF; border-collapse: collapse; border-color: Black' cellpadding=3><tr><th>Field Name</th><th>Field Type</th><th>Field Size</th></tr>") for i=0 to oRs.fields.count-1 response.write("<tr><td>" & oRs.fields(i).name & "</td>") response.write("<td>" & oRs.fields(i).type & "</td>") response.write("<td>" & oRs(i).DefinedSize & "</td>") response.write("</tr>") next response.write("</table></center>") oRs.close Set oRs=nothing %> |