Ver Mensaje Individual
  #6 (permalink)  
Antiguo 13/02/2009, 06:20
sergiogmuro
 
Fecha de Ingreso: junio-2007
Ubicación: Argentina
Mensajes: 111
Antigüedad: 19 años, 4 meses
Puntos: 0
Respuesta: Error en Arrays (For i=0 ) de c#

Listo chicos.. lo pude solucionar... le tuve que poner un +1 al :
Código PHP:
for (i = 0; i<vect.GetUpperBound(0)+1; i++) 
porque me contaba siempre uno antes.. entonces no terminaba la sentencia y daba error....

Bueno aca abajo les dejo el codigo por si a alguno le sirve... si es asi comenten o agradescan que no cuesta nada...

Código PHP:
    protected void Page_Load(object sender, EventArgs e)
    {
        if (
Request.QueryString["id"]!=null)
        {
            
id = Request.QueryString["id"].ToString();
        }
        
        if (
id == null)
        {
              
id = "";
        }
//------ SEPARA PARA LA BUSQUEDA SI TENE MAS DE UN ARTICULO -------\\
        
string[] vect;
        
string strLike;
        
int i;
        
char[] splitter  = {' '};
        
vect = id.Split(splitter);
       
        if (
vect.GetUpperBound(0) > 0)
        {
            
strLike = " like ";

            for (
i = 0; i<vect.GetUpperBound(0)+1; i++)
            {
                
strLike = strLike + "'%" + vect[i] + "%'";
                 if (
i < vect.GetUpperBound(0))
                { 
                
strLike = strLike + " or Articulo_Descripcion like "; 
                }else{
                
strLike = strLike + " or Articulo_Codigo like '%" +  vect[i] + "%' ";
                }
            }
        }else{
        
strLike = " like '%" + id + "%' ";
        }
//---------- FIN DEL CODIGO SEPARADOR DE STRINGS ------ \\

//---------- CONECCION DEL CODIGO CON LA BASE DE DATOS EN FOREACH ------ \\
        
dt_search = SearchArticulo.Search(strLike);
        foreach(
System.Data.DataRow dr in dt_search.Rows)
        {
//---------------------------------------------------------------------------------------------------\\

//----------  ASI QUEDO EL ARCHIVO DE CONEXION CON BASE -------- \\
string comando = "Select * from articulo where Articulo_Descripcion " + Articulo_Codigo + " and Articulo_Activo='SI' and Articulo_Sold='NO'";
//---------- --------------------------------------------------------------- -------- \\ 
Gracias a todos