Gets the column ID, datatype, maximum length, type of aggregate function, and aggregate type name of a specific column in the current set of results.
SqlGetAltColInfo% ( sqlconn%, altcolumndata, computeid%, altcolumn% )
where
SUCCEED (1) or FAIL (0). The column ID, datatype, maximum length, type of aggregate function, and name of the aggregate operator type are returned by the altcolumndata parameter.
SqlGetAltColInfo% performs the actions of several other Visual Basic functions and puts the results of the functions in the corresponding elements of the altcolumndata parameter. SqlGetAltColInfo% is the equivalent of calling SqlAltColId%, SqlAltLen%, SqlAltOp%, and SqlAltType%. To access an element returned by altcolumndata, you must use the point (.) notation:
altcolumndata.elementname
For example, the following statement gets the column name returned by altcolumndata :
AggregateOperatorName$ = AltColumnData.AggOpName$
Dim AltColDetails As AltColumnData 'Put commands into the command buffer. cmd$ = "SELECT title_id, price, advance FROM titles" cmd$ = cmd$ " COMPUTE SUM(price), MAX(advance)" Result% = SqlCmd%(SqlConn%, cmd$) 'Send the command to SQL Server and start execution. Result% = SqlExec%(SqlConn%) Result% = SqlResults%(SqlConn%) 'Get the column ID, datatype, and name of the aggregate operator from compute columns and print the results. IF Result% = SUCCEED THEN DO UNTIL SqlNextRow%(SqlConn%) = NOMOREROWS IF Result% = REGROW THEN PRINT "regular row returned." PRINT ELSE GetAltColInfo% = SqlGetAltColInfo%(SqlConn%, AltColDetails, ComputeId%, AltColumn%) IF GetAltColInfo% = SUCCEED THEN AltColumnID% = AltColDetails.ColID% ColDatatype% = AltColDetails.Datatype% AggregateOperator$ = AltColDetails.AggOpName$ PRINT "Column ID of compute column = " AltColumnID% PRINT "Datatype of column = " ColData type% PRINT "Aggregate Operator of column = " AggregateOperator$ PRINT END IF END IF LOOP
SqlAltColId%, SqlAltLen%, SqlAltOp%, SqlAltType%, SqlGetColumnInfo%