Forum

July 10th, 2011
You must be logged in to post Login Register

Search Forums:


 






jqGrid on asp.net mvc 1.0

UserPost

23:33
23/05/2012


kiga

New Member

posts 1

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


About the jQuery Grid Plugin – jqGrid forum

Most Users Ever Online:

157


Currently Online:

69 Guests

Forum Stats:

Groups: 1

Forums: 7

Topics: 9661

Posts: 28949

Membership:

There are 10357 Members

There have been 448 Guests

There is 1 Admin

There are 2 Moderators

Top Posters:

OlegK – 1167

markw65 – 179

kobruleht – 144

phicarre – 126

YamilBracho – 124

Renso – 118

Administrators: admin (56 Posts)

Moderators: tony (7043 Posts), Rumen[Trirand] (81 Posts)




Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information