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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filling DataSet problem

Status
Not open for further replies.

jcsilva

Programmer
Aug 17, 2002
6
MX
Hi there,

I have a problem filling a DataSet. Here are the background:

I'm executing a SP that retrieve some data, about (26 records). Those records have 3 string columns.

When I fill the DataSet with this results, there is no problem, I can fill a DataGrid a display it in the aspx. But in other execution, the SP return more data, the DataSet isn't filled, namely, the DataSet is empty. The Query is OK.

I have been tried some things. I have changed the wide of the columns with SUBSTR function and temporaly I resolve the problem. But I need display all the content of the columns. I have been played with the wide of these 3 columns and results are mixed, sometimes works, sometimes don't.

This is a fragment code of the Store Procedure
Code:
....
SELECT CTR_CONTRATO.con_numcontrato con_numcontrato, SUBSTR(CTR_CONTRATO.con_descripcion, 0, 50) con_descripcion, SUBSTR(CTR_CONTRATO.con_compania, 0, 20) con_compania, SUBSTR(CTR_CONTRATO.con_observacion, 0, 55) con_observacion,
....

This is my C# code

Code:
	OracleCommand  oOracleCmd;
	oOracleCmd = new OracleCommand();
	
	oOracleCmd.Connection = oOracleConx;
	oOracleCmd.CommandText = "PKG_CONTRATOS.sp_rep_contratos";
	oOracleCmd.CommandType = CommandType.StoredProcedure;
	
	oOracleCmd.Parameters.Add(new OracleParameter("IO_CURSOR", OracleType.Cursor)).Direction = ParameterDirection.Output;
	oOracleCmd.Parameters.Add(new OracleParameter("pSQL", OracleType.VarChar, 10000)).Direction = ParameterDirection.Output;
		
	OracleDataAdapter oOracleAdapter = new OracleDataAdapter(oOracleCmd);
	
	DataSet ods = new dsRepctr();  // DataSet
	
	oOracleAdapter.Fill(ods,"CTR_CONTRATO");

	dgTemp.DataSource = ods;
	dgTemp.DataBind();
	.....
	.....

This is the DataSet XML code:

Code:
<?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?>
<xs:schema id=&quot;dsRepctr&quot; targetNamespace=&quot;[URL unfurl="true"]http://tempuri.org/dsRepctr.xsd&quot;[/URL] elementFormDefault=&quot;qualified&quot; attributeFormDefault=&quot;qualified&quot; xmlns=&quot;[URL unfurl="true"]http://tempuri.org/dsRepctr.xsd&quot;[/URL] xmlns:mstns=&quot;[URL unfurl="true"]http://tempuri.org/dsRepctr.xsd&quot;[/URL] xmlns:xs=&quot;[URL unfurl="true"]http://www.w3.org/2001/XMLSchema&quot;[/URL] xmlns:msdata=&quot;urn:schemas-microsoft-com:xml-msdata&quot;>
<xs:element name=&quot;dsRepctr&quot; msdata:IsDataSet=&quot;true&quot;>
<xs:complexType>
<xs:choice maxOccurs=&quot;unbounded&quot;>
<xs:element name=&quot;CTR_CONTRATO&quot;>
<xs:complexType>
	<xs:sequence>
		<xs:element name=&quot;CON_NUMCONTRATO&quot; type=&quot;xs:string&quot; />
		<xs:element name=&quot;CON_DESCRIPCION&quot; type=&quot;xs:string&quot; minOccurs=&quot;0&quot; />
		<xs:element name=&quot;CON_COMPANIA&quot; type=&quot;xs:string&quot; minOccurs=&quot;0&quot; />
		<xs:element name=&quot;CON_OBSERVACION&quot; type=&quot;xs:string&quot; minOccurs=&quot;0&quot; />
		<xs:element name=&quot;CON_MONTOPESOS&quot; type=&quot;xs:decimal&quot; minOccurs=&quot;0&quot; />
		<xs:element name=&quot;CON_MONTODOLAR&quot; type=&quot;xs:decimal&quot; minOccurs=&quot;0&quot; />
		<xs:element name=&quot;CON_IDCOMPANIA&quot; type=&quot;xs:int&quot; minOccurs=&quot;0&quot; />
		<xs:element name=&quot;CON_IDCON&quot; type=&quot;xs:int&quot; minOccurs=&quot;0&quot; />
		<xs:element name=&quot;FECHA_AMP&quot; type=&quot;xs:date&quot; minOccurs=&quot;0&quot; />
		<xs:element name=&quot;MONTO_AMP_PESOS&quot; type=&quot;xs:decimal&quot; minOccurs=&quot;0&quot; />
		<xs:element name=&quot;MONTO_AMP_DOLAR&quot; type=&quot;xs:decimal&quot; minOccurs=&quot;0&quot; />
		<xs:element name=&quot;ACUOBRAS_PESOS&quot; type=&quot;xs:decimal&quot; minOccurs=&quot;0&quot; />
		<xs:element name=&quot;ACUOBRAS_DOLLAR&quot; type=&quot;xs:decimal&quot; minOccurs=&quot;0&quot; />
		<xs:element name=&quot;SUMMTOADIPESOS&quot; type=&quot;xs:decimal&quot; minOccurs=&quot;0&quot; />
		<xs:element name=&quot;SUMMTOADIDOLAR&quot; type=&quot;xs:decimal&quot; minOccurs=&quot;0&quot; />
		<xs:element name=&quot;SALDOPESOS&quot; type=&quot;xs:decimal&quot; minOccurs=&quot;0&quot; />
		<xs:element name=&quot;SALDODOLAR&quot; type=&quot;xs:decimal&quot; minOccurs=&quot;0&quot; />
		<xs:element name=&quot;INICIO&quot; type=&quot;xs:string&quot; minOccurs=&quot;0&quot; />
		<xs:element name=&quot;FIN&quot; type=&quot;xs:string&quot; minOccurs=&quot;0&quot; />
	</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

The problem is with the number of characters returned in the string columns, but I think isn't normal, because I'm working with columns(varchar2) that have 255 character max

Any idea??



________________________________
Juan Carlos Silva
Software Developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top