Código:
Partial Class cup Inherits System.Web.UI.Page Dim DA As New SqlDataAdapter Dim DS As New DataSet Dim con As New SqlConnection Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load con.ConnectionString = "Data Source=JOSE;Initial Catalog=cup;Integrated Security=True" con.Open() DA = New SqlDataAdapter("SELECT * FROM cups", con) DA.SelectCommand.ExecuteNonQuery() DA.Fill(DS) cb2.DataSource = DS.Tables(0) cb2.DataBind() End Sub Protected Sub busca_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles busca.Click Dim Sql As String = "SELECT * FROM cups WHERE ImageID=" & buscatxt.Text DA = New SqlDataAdapter(Sql, con) DA.SelectCommand.ExecuteNonQuery() DA.Fill(DS) cb2.DataSource = DS.Tables(0) cb2.DataBind() End Sub Protected Sub cb2_PageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs) cb2.PageIndex = e.NewPageIndex cb2.DataBind() End Sub
Gracias! espero me ayuden. Saludos.