Foros del Web » Programación para mayores de 30 ;) » .NET »

Urgente Error

Estas en el tema de Urgente Error en el foro de .NET en Foros del Web. TENGO EL SIGUIENTE ERROR No se ha inicializado la propiedad SelectCommand antes de llamar a 'Fill'. Y TENGO EL SIGUIENTE CODIGO DONDE SE ME PRODUCE ...
  #1 (permalink)  
Antiguo 24/03/2005, 10:01
 
Fecha de Ingreso: marzo-2005
Mensajes: 190
Antigüedad: 19 años, 3 meses
Puntos: 0
Urgente Error

TENGO EL SIGUIENTE ERROR

No se ha inicializado la propiedad SelectCommand antes de llamar a 'Fill'.

Y TENGO EL SIGUIENTE CODIGO DONDE SE ME PRODUCE ESE ERROR ALGUIEN ME PODRIA DECIR QUE ME FALTA


Dim connectionString As String = "server='192.168.100.254'; user id='SA'; password=''; database='Sistema Administrativo'; trusted_connection=true"
Dim queryString As String = "SELECT[Inventario].[Item], [Inventario].[Modelo], [Inventario].[Inventario], [Inventario].[Equipo], [Inventario].[Fecha Compra], [Inventario].[Serie], [Inventario].[Valor Compra], [Inventario].[Lugar], [Inventario].[Ubicacion] FROM [Inventario]"
Dim isediting As Boolean = False


Private Sub page_load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
bindgrid()
End If
End Sub


Sub bindgrid()
Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionStri ng)
Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand()
Dim dataadapter As System.Data.IDbDataAdapter = New System.Data.SqlClient.SqlDataAdapter()
Dim dataset As System.Data.DataSet = New System.Data.DataSet()
dataadapter.Fill(dataset)
DataGrid1.DataSource = dataset
DataGrid1.DataBind()
End Sub
__________________
MARIA JESUS :si: :aplauso:

----------------------------------------------------
"no hay nada bueno ni malo el pensar lo hace asi"
w.shakespeare
  #2 (permalink)  
Antiguo 24/03/2005, 10:25
 
Fecha de Ingreso: marzo-2005
Mensajes: 20
Antigüedad: 19 años, 2 meses
Puntos: 0
Pues cuando creas el DataAdapter te falta pasarle la querystring y la conexion

New System.Data.SqlClient.SqlDataAdapter(querystring, dbConnection)

Ademas tal como tienes eso ahi, te sobra el dbCommand
  #3 (permalink)  
Antiguo 24/03/2005, 10:33
 
Fecha de Ingreso: marzo-2005
Mensajes: 190
Antigüedad: 19 años, 3 meses
Puntos: 0
gracias por tu ayuda ya solucione el problema
__________________
MARIA JESUS :si: :aplauso:

----------------------------------------------------
"no hay nada bueno ni malo el pensar lo hace asi"
w.shakespeare
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:40.