<HTML>
<FONT style="FONT-SIZE: 10pt; FONT-FAMILY: tahoma">
<DIV>Gente al&nbsp;cargar una grilla se ejecuta por cada paginado un metodo 
contra Sybase 10. Se ejecuta una, dos, tres, cuatro y a la quinta vez, por 
ejemplo, tira el error <FONT size=2><I>Resource governor for 'prepared 
statements' exceeded</I> .</FONT></DIV>
<DIV>Les paso el metodo como para aclarar un poco ms:</DIV>
<DIV>&nbsp;</DIV><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<DIV>Public</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>
<FONT color=#0000ff size=2>Sub</FONT></FONT><FONT size=2> 
GetCategorias()</DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Try</FONT>
</FONT></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV><FONT size=2></FONT><FONT color=#0000ff size=2><FONT color=#0000ff 
size=2>Dim</FONT></FONT><FONT size=2> adpt </FONT><FONT color=#0000ff size=2>
<FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> 
OleDbDataAdapter</DIV></BLOCKQUOTE>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Dim</FONT>
</FONT><FONT size=2> comm </FONT><FONT color=#0000ff size=2><FONT 
color=#0000ff size=2>As</FONT></FONT><FONT size=2> </FONT><FONT 
color=#0000ff size=2><FONT color=#0000ff size=2>New</FONT></FONT><FONT 
size=2> OleDbCommand</DIV>
<DIV>TablaCategorias = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff 
size=2>New</FONT></FONT><FONT size=2> dsSiMaPa.CategoriasDataTable</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>If</FONT>
</FONT><FONT size=2> connSiMaPa.State = ConnectionState.Closed </FONT><FONT 
color=#0000ff size=2><FONT color=#0000ff size=2>Then</DIV></FONT></FONT>
<FONT size=2>
<DIV>connSiMaPa.Open()</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>End</FONT>
</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff 
size=2>If</DIV></FONT></FONT><FONT size=2>
<DIV>comm.Connection = connSiMaPa</DIV>
<DIV>comm.CommandType = CommandType.Text</DIV>
<DIV>comm.CommandText = "SELECT * FROM Categorias ORDER BY 
caDescripcion"</DIV>
<DIV>adpt = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
New</FONT></FONT><FONT size=2> OleDbDataAdapter(comm)</DIV>
<DIV>adpt.Fill(Categorias)</DIV>
<DIV>adpt = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
Nothing</DIV></FONT></FONT><FONT size=2>
<DIV>comm = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
Nothing</DIV></FONT></FONT><FONT size=2>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
Catch</FONT></FONT><FONT size=2> ex1 </FONT><FONT color=#0000ff size=2><FONT 
color=#0000ff size=2>As</FONT></FONT><FONT size=2> OleDbException</DIV>
<DIV>Console.Write(ex1.Message)</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
Catch</FONT></FONT><FONT size=2> ex2 </FONT><FONT color=#0000ff size=2><FONT 
color=#0000ff size=2>As</FONT></FONT><FONT size=2> Exception</DIV>
<DIV>Console.Write(ex2.Message)</DIV></BLOCKQUOTE>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>End</FONT>
</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff 
size=2>Try</DIV></BLOCKQUOTE></FONT></FONT><FONT size=2>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>End</FONT>
</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff 
size=2>Sub</DIV>
<DIV></FONT></FONT>&nbsp;</DIV>
<DIV>o en su defecto en este.</DIV>
<DIV>&nbsp;</DIV><FONT size=2>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
Public</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT 
color=#0000ff size=2>Function</FONT></FONT><FONT size=2> GetCategoria(</FONT>
<FONT color=#0000ff size=2><FONT color=#0000ff size=2>ByVal</FONT></FONT>
<FONT size=2> icaId </FONT><FONT color=#0000ff size=2><FONT color=#0000ff 
size=2>As</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT 
color=#0000ff size=2>Integer</FONT></FONT><FONT size=2>) </FONT><FONT 
color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2>
 </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>String</DIV>
</FONT></FONT><FONT size=2>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Dim</FONT>
</FONT><FONT size=2> sNombre </FONT><FONT color=#0000ff size=2><FONT 
color=#0000ff size=2>As</FONT></FONT><FONT size=2> </FONT><FONT 
color=#0000ff size=2><FONT color=#0000ff size=2>String</DIV></FONT></FONT>
<FONT size=2>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Dim</FONT>
</FONT><FONT size=2> comm </FONT><FONT color=#0000ff size=2><FONT 
color=#0000ff size=2>As</FONT></FONT><FONT size=2> </FONT><FONT 
color=#0000ff size=2><FONT color=#0000ff size=2>New</FONT></FONT><FONT 
size=2> OleDbCommand</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Dim</FONT>
</FONT><FONT size=2> drCategoria </FONT><FONT color=#0000ff size=2><FONT 
color=#0000ff size=2>As</FONT></FONT><FONT size=2> OleDbDataReader</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>If</FONT>
</FONT><FONT size=2> connSiMaPa.State = ConnectionState.Closed </FONT><FONT 
color=#0000ff size=2><FONT color=#0000ff size=2>Then</DIV></FONT></FONT>
<FONT size=2>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV>connSiMaPa.Open()</DIV></BLOCKQUOTE>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>End</FONT>
</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff 
size=2>If</DIV></FONT></FONT><FONT size=2>
<DIV>comm.Connection = connSiMaPa</DIV>
<DIV>comm.CommandType = CommandType.Text</DIV>
<DIV>comm.CommandText = "SELECT caDescripcion FROM Categorias WHERE caId = " 
&amp; icaId.ToString</DIV>
<DIV>comm.Prepare()</DIV>
<DIV>drCategoria = comm.ExecuteReader</DIV>
<DIV>drCategoria.Read()</DIV>
<DIV>sNombre = Trim(drCategoria.GetValue(0))</DIV>
<DIV>drCategoria.Close()</DIV>
<DIV>drCategoria = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff 
size=2>Nothing</DIV></FONT></FONT><FONT size=2>
<DIV>comm = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
Nothing</DIV></FONT></FONT><FONT size=2>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
Return</FONT></FONT><FONT size=2> sNombre</DIV></BLOCKQUOTE>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>End</FONT>
</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff 
size=2>Function</DIV></FONT></FONT>
<DIV><BR>&nbsp;</DIV></FONT>
</HTML>

Responder a