Post edited 23:36 – 23/05/2012 by kiga
hi everyone, i'm recently discover this plugin, and i would like to use it on a application that i'm currently developing, but i don't know how to populate the grid, using data, that i'm extracting from my db2 as400 database, using oledb.
i can create a type Json with the sql query from my database, but i don't know how to use for populate my grid, and how to obtain the rest of the data like rows, pages, records
anyone can help me?
thanks!!!
some of my code:
public ActionResult UpdateProductoA(string words, string clave1,
string clave2)
{
List<Detalle> mySource = miConexion.DatosProductoA(username, password, words, clave1, clave2);
List<string> retornar = new List<string>();
foreach (var item in mySource)
{
retornar.Add(item.nombreArticulo);
retornar.Add(item.unidadMedida);
}
return Json(retornar);
}
#region DatosProductoA() Actualiza valores en EntradaPedidosDetalle bajo ciertos parametros
public List<Detalle> DatosProductoA(string username, string password,
string words, string clave1, string clave2)
{
List<Detalle> datosProducto = new List<Detalle>();
try
{
OleDbConnection conexion = new OleDbConnection
(@"Provider=IBMDA400.DataSource.1;
Data Source=neptuno;
Persist Security Info=True;
Password=" + password + @";
User ID=" + username +
@";Default Collection=tesdatos");
OleDbCommand comandoSelect = new OleDbCommand(@"SELECT ZSUPDS AS NOMART, XCDUMS AS UNIDAD
FROM TESDATOS.ARTMS21L
LEFT JOIN TESDATOS.ARTNM01L ON ZRECTY=XRECTY AND ZCDKE1=XCDKE1
WHERE ZRECTY =('" + words.ToString() + @"')
AND ZCDKE1 =('" + clave1.ToString() + @"')
AND ZCDKE2 =('" + clave2.ToString() + @"')", conexion);
comandoSelect.Connection = conexion;
conexion.Open();
comandoSelect.ExecuteNonQuery();
OleDbDataReader resultado = comandoSelect.ExecuteReader();
while (resultado.Read())
{
Detalle misDatos = new Detalle();
misDatos.nombreArticulo = resultado.GetString(0);
misDatos.unidadMedida = resultado.GetString(1);
datosProducto.Add(misDatos);
}
conexion.Close();
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}
return datosProducto;
}
#endregion