Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sort DataGrid using dbComboBox Selection

Status
Not open for further replies.

GeromeEo

Programmer
Feb 26, 2001
3
US
I can get a date from LOCALDATE to be selected then show up in the DataCombo box, but do not know how to use it via the command button and ADOs to recreate a where clause to only show 'that' day in the Datagrid.

To start with I am using two tables and one view from an Oracle database (LOCALDATE,MWHActuals,V_MWHActuals).

I want the user to select a day (01/22/2002) from the DataComboBox (from LOCALDATE) dropdown menu, click a SEARCH command button (cmdGetData), and populate a datagrid(grdMWHActuals)(fromV_MWHActuals) with only that days data.
I have created two ADO connections for the other objects to use also.
AdoDataSource
ConnectString = (through a Oracle client Net8 connection to the Oracle DB... and this seems to work)
RecordSource= ( Select * from V_MWHACTUALS ) which will populate the grid when program starts with 2 months data
AdoRowSource
ConnectString = ( same as above)
RecordSource = ( Select distinct trunc(LOCALDATE) from LOCALDATE

DcbLOCALDATE
RowSource = adoRowSource
DataSource = adoRowSource

GrdMWHActuals
Datasource = adoDataSource
DataMember = <blank>

Table Definitions:
LOCALDATE
Create table LOCALDATE (UTCTIME DATE NULL, LOCALDATE DATE NULL)
V_MWHACTUALS
Create View V_MWHACTUALS (DATE_TIME, SO_SCE, ML_CFE, IV_ML, TOTAL) AS
Select to_char(xa_time_cnv.utc_to_loc(I1.UTCTIME),'MON-DD-YY HH24:MI'), I1.Value, I2.Value, I3.Value, I4.Value
FROM MWHACTUALS I1, MWHACTUALS I2, MWHACTUALS I3, MWHACTUALS I4
WHERE I1.UTCTIME= I2.UTCTIME and I1.UTCTIME = I3.UTCTIME and I.1.UTCTIME = I4.UTCTIME and
I1.PointNumber=30277 and I2.PointNumber=30278 and I3.PointNumber=30279 and I4.PointNumber=30280
Order by I1.UTCTIME
MWHACTUALS
Create table MWHACTUALS (UTCTIME DATE NOT NULL, PointNumber INT NOT NULL, Value FLOAT DEFAULT (0.0),
TLQ INT DEFAULT (32), UNIQUE (PointNumber, UTCTIME))

Problem:
As of right now, I can run the program with basically only the properties settings and no code and get the dcbLOCALDATE to have a dropdown list of dates for two months ( unfortunately not in desc order), the cmdGetData does not work, and the grdMWHACTUALS populates with all hourly collections for 2 months, but no column sums. Also, I set LOCALDATE as Parent and MWHACTUALS as child (bound by UTCTIME).

I can get a date from LOCALDATE to be selected then show up in the DataCombo box, but do not know how to use it via the command button and ADOs to recreate a where clause to only show 'that' day in the grid.

Summing the columns is another &quot;never done did before&quot; for me.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top