01-20-2009, 12:18 AM
A Database check would be dependant on what you need to check.... is it the number of records being returned or the actual field name values?
What database are you connecting to? for examples of connection strings see: http://www.connectionstrings.com/
I have a control file that the Parameters are passed from I'm connecting to three different databases depending which on is switched on the control file on my test box.
Once you have opened the connection to the server all you need to do is run the SQL query:
for me I'm just verifying the number of records being returned so my "sqlstring" is being built in another process and as it only returns the count you can put the count in a variable as below
Then you can do a compare with you database count and the number of records displayed on your Application..
What database are you connecting to? for examples of connection strings see: http://www.connectionstrings.com/
I have a control file that the Parameters are passed from I'm connecting to three different databases depending which on is switched on the control file on my test box.
Code:
DBType=GetLocalParameter("profile.database")
If DBType="Oracle" Then
UID = GetLocalParameter("oracle.user")
PWD = GetLocalParameter("oracle.password")
SERVER= GetLocalParameter("oracle.servername")
set conn=Createobject("ADODB.Connection")
Srvname="DRIVER={Microsoft ODBC for Oracle};UID="&UID&";PWD="&PWD&";SERVER="&SERVER&";"
conn.open Srvname
Elseif DBType="sqlserver" Then
UID = GetLocalParameter("sqlserver.user")
PWD = GetLocalParameter("sqlserver.password")
SERVER= GetLocalParameter("sqlserver.servername")
DATABASE= GetLocalParameter("sqlserver.servername")
DATASOURCE=GetLocalParameter("sqlserver.host")
PORTNUM=GetLocalParameter("sqlserver.port")
set conn=Createobject("ADODB.Connection")
Srvname= "PROVIDER=SQLOLEDB;DATA SOURCE="&DATASOURCE&","&PORTNUM&";UID="&UID & ";PWD="&PWD&";DATABASE="
conn.open Srvname
Elseif DBType="isam" Then
DATASOURCE=GetLocalParameter("isam.datasource")
set conn=Createobject("ADODB.Connection")
Srvname="Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq="&DATASOURCE&"; "
msgbox(Srvname)
conn.open Srvname
End If
Once you have opened the connection to the server all you need to do is run the SQL query:
Code:
Set Rec = CreateObject("ADODB.Recordset")
SQL= ""&sqlstring&" "
Rec.open SQL ,conn
for me I'm just verifying the number of records being returned so my "sqlstring" is being built in another process and as it only returns the count you can put the count in a variable as below
Code:
Total_Count=rec(0)
Then you can do a compare with you database count and the number of records displayed on your Application..