Tornado Class Library

Special Topic - Oracle

Tornado supports Oracle via the ODBC, OLEDB and OracleClient providers.

Example - Implement Oracle boolean field

Oracle has no boolean field. The following implements the boolean field using VARCHAR(1) and VARCHAR(5). Go to Scott/Tiger's EMP database and add a field at the end called BOOL of VARCHAR2(1).

<script language="vb" runat="server">
Sub Page_Load(Source as Object, E as EventArgs)
   Dim X As New Tornado.z
   X.dbQP = "U=1|S=1|M=Grid!sys=t|D=GDB817;scott;tiger|ni=b5,u pdate|Q=EMP| bm=EMP;0| Dt=Oracle| Pv=OracleClient"
   X.dbTextHolder = "Title=Oracle Update"
   X.dbCommonTables = "ind=t|value=Y,N"
   X.dbEditUpdateFlds = "fi=0|Ty=RONOUP,fi=bool|ty=selectbox|val=t"
   X.dbGridUpdateTemplate = "<h2>My Grid Update template</h2><P> [[GridUpdate]]<BR>[[GridNav]]"
   X.ASPdbNET()
End Sub
</script>
 

Now, to use the checkbox to update the field like a boolean field is a bit tricky. We just have to stuff the field with true/false instead. Change the BOOL field to size of 5 instead of 1 and populate the values with "true" or "False" (no exception). Use the following code to update the field and now the checkbox will sync with the true/false value.

<script language="vb" runat="server">
Sub Page_Load(Source as Object, E as EventArgs)
   Dim X As New Tornado.z
   X.dbQP = "U=1|S=1|M=Grid!sys=t|D=GDB817;scott;tiger|ni=b5,u pdate|Q=EMP| bm=EMP;0| Dt=Oracle| Pv=OracleClient"
   X.dbTextHolder = "Title=Oracle Update"
   X.dbCommonTables = "ind=t|value=true,false"
   X.dbEditUpdateFlds = "fi=0|Ty=RONOUP,fi=bool|ty=checkbox|val=t"
   X.dbGridUpdateTemplate = "<h2>My Grid Update template</h2><P> [[GridUpdate]]<BR>[[GridNav]]"
   X.ASPdbNET()
End Sub
</script>

 


Send comments on this topic.

Copyright 1998-2007 ASP-db