예제 #1
0
        public static string[] GetCompletionList(string prefixText)
        {
            //
            // return (from m in nombres where m.StartsWith(prefixText,StringComparison.CurrentCultureIgnoreCase) select m).Take(count).ToArray();
            Conexion   con = new Conexion();
            SqlCommand cmd = con.AbrirConexionData_P2B();

            cmd.CommandText = "Select TOP 15 QG_RMS_JOB_NBR from QGPressJob pj inner join Produccion.dbo.OTAsignada oa " +
                              "on pj.QG_RMS_JOB_NBR collate SQL_Latin1_General_CP1_CI_AS=oa.NumeroOT collate SQL_Latin1_General_CP1_CI_AS " +
                              "inner join intranet2.dbo.usuarios usu on usu.idUsuario=oa.IDUsuario where oa.Estado=1 and pj.job_sts=1 " +
                              "and usu.usuario=@NomUsu and QG_RMS_JOB_NBR like @prefixText";

            SqlDataAdapter da = new SqlDataAdapter(cmd);

            da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar, 50).Value = prefixText + "%";
            da.SelectCommand.Parameters.Add("@NomUsu", SqlDbType.VarChar, 50).Value     = nomUsuario;
            DataTable dt = new DataTable();

            da.Fill(dt);
            string[] items = new string[dt.Rows.Count];
            int      i     = 0;

            foreach (DataRow dr in dt.Rows)
            {
                items.SetValue(dr["QG_RMS_JOB_NBR"].ToString(), i);
                i++;
            }
            return(items);
        }