Ver Mensaje Individual
  #2 (permalink)  
Antiguo 17/04/2008, 03:12
aisbel
 
Fecha de Ingreso: febrero-2008
Mensajes: 43
Antigüedad: 16 años, 2 meses
Puntos: 0
Re: ayuda con CSharp y consultas xfavor

Hola codeman,

yo no sé mucho de .net, pero voy a intentar ayudarte.

Primero, creo que te falta lo mas importante:

using System.Data.SqlClient;

y luego yo haría el sigiente codigo:

SqlConnection myConnection = new SqlConnection("Data Source=localhost;Initial Catalog=BDDatos;Persist Security Info=True;User ID=sa;Password=pass");


string SQL_QUERY = "select * from revista";
SqlCommand myCommand = new SqlCommand(SQL_QUERY, myConnection);


SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);

DataTable myTable = new DataTable();
myAdapter.Fill(myTable);

dgProducts.DataSource = myTable;
dgProducts.DataBind();
myConnection.Close();


Prueba eso, espero que te sirva de algo....