String strmodelid = This. htmodel [This. cmbmodel. selecteditem. tostring ()]. tostring ();
String strorderid = This. httype [This. cmbordertype. selecteditem. tostring ()]. tostring ();
ADODB. recordset rst = new ADODB. recordsetclass ();
RST = DT. testadodb (strorderid, strmodelid );
This. axctlvoucher1.settemplatedata (ref (object) RST );
Change
String strmodelid = This. htmodel [This. cmbmodel. selecteditem. tostring ()]. tostring ();
String strorderid = This. httype [This. cmbordertype. selecteditem. tostring ()]. tostring ();
ADODB. recordset rst = new ADODB. recordsetclass ();
RST = DT. testadodb (strorderid, strmodelid );
Object TMP = (object) RST;
This. axctlvoucher1.settemplatedata (ref TMP );
You can.
Cause:
Here we need to consider the details of type forced conversion. During forced conversion, the compiler will generate a temporary reference and then pass this temporary reference to a reference of the same type as the conversion, this temporary reference is special-it is not a left value (L) and cannot be assigned a value! The method for using the ref parameter generally needs to modify this reference. If the temporary reference is directly passed in, the compiler will complain that the ref or out parameter must be an L. WhileCode2. Assign the temporary reference to a regular reference. Then, the regular reference can be copied.