Mostrar datos en un GridView recibiendo un parametro

20/05/2010 - 20:31 por aramirez333 | Informe spam
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

Dim rut_historial As String

rut_historial = Request.QueryString("Rut")

Dim conectar As New Conexion
Dim dt As New DataTable
Dim con As New SqlConnection(conectar.cadena)
Dim da As New SqlDataAdapter("sptHistorial", con)

Try
con.Open()

da.SelectCommand.CommandType = CommandType.StoredProcedure
da.SelectCommand.Parameters.AddWithValue("@rut_cliente",
rut_historial)
da.SelectCommand.ExecuteNonQuery()
da.Fill(dt)
dt.TableName = "sptHistorial"
GridView1.DataSource = dt
GridView1.DataBind()

con.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class

Preguntas similare

Leer las respuestas

#1 Jonathan Ledesma Medina
20/05/2010 - 20:40 | Informe spam
On 20 mayo, 14:31, ""
wrote:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

Dim rut_historial As String

rut_historial = Request.QueryString("Rut")

Dim conectar As New Conexion
Dim dt As New DataTable
Dim con As New SqlConnection(conectar.cadena)
Dim da As New SqlDataAdapter("sptHistorial", con)

Try
con.Open()

da.SelectCommand.CommandType = CommandType.StoredProcedure
da.SelectCommand.Parameters.AddWithValue("@rut_cliente",
rut_historial)
da.SelectCommand.ExecuteNonQuery()
da.Fill(dt)
dt.TableName = "sptHistorial"
GridView1.DataSource = dt
GridView1.DataBind()

con.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class






Ni un brillo
email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida