Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:GridView ID="GridView1" runat="server"> <Columns> <asp:CommandField ShowEditButton="True" /> </Columns> </asp:GridView> <asp:Button ID="Button1" runat="server" Text="Button" /> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:test1ConnectionString %>" DeleteCommand="DELETE FROM [Alumnos] WHERE [boleta] = @boleta" InsertCommand="INSERT INTO [Alumnos] ([boleta], [nombre], [appat], [apmat], [contraseña], [escuela], [correo], [sexo], [curso], [calificacion], [cr1], [p1], [cf1], [cr2], [p2], [cf2], [cr3], [p3], [cf3]) VALUES (@boleta, @nombre, @appat, @apmat, @contraseña, @escuela, @correo, @sexo, @curso, @calificacion, @cr1, @p1, @cf1, @cr2, @p2, @cf2, @cr3, @p3, @cf3)" SelectCommand="SELECT * FROM [Alumnos]" UpdateCommand="UPDATE [Alumnos] SET [nombre] = @nombre, [appat] = @appat, [apmat] = @apmat, [contraseña] = @contraseña, [escuela] = @escuela, [correo] = @correo, [sexo] = @sexo, [curso] = @curso, [calificacion] = @calificacion, [cr1] = @cr1, [p1] = @p1, [cf1] = @cf1, [cr2] = @cr2, [p2] = @p2, [cf2] = @cf2, [cr3] = @cr3, [p3] = @p3, [cf3] = @cf3 WHERE [boleta] = @boleta"> <DeleteParameters> <asp:Parameter Name="boleta" Type="String" /> </DeleteParameters> <InsertParameters> <asp:Parameter Name="boleta" Type="String" /> <asp:Parameter Name="nombre" Type="String" /> <asp:Parameter Name="appat" Type="String" /> <asp:Parameter Name="apmat" Type="String" /> <asp:Parameter Name="contraseña" Type="String" /> <asp:Parameter Name="escuela" Type="String" /> <asp:Parameter Name="correo" Type="String" /> <asp:Parameter Name="sexo" Type="String" /> <asp:Parameter Name="curso" Type="String" /> <asp:Parameter Name="calificacion" Type="String" /> <asp:Parameter Name="cr1" Type="String" /> <asp:Parameter Name="p1" Type="String" /> <asp:Parameter Name="cf1" Type="String" /> <asp:Parameter Name="cr2" Type="String" /> <asp:Parameter Name="p2" Type="String" /> <asp:Parameter Name="cf2" Type="String" /> <asp:Parameter Name="cr3" Type="String" /> <asp:Parameter Name="p3" Type="String" /> <asp:Parameter Name="cf3" Type="String" /> </InsertParameters> <UpdateParameters> <asp:Parameter Name="nombre" Type="String" /> <asp:Parameter Name="appat" Type="String" /> <asp:Parameter Name="apmat" Type="String" /> <asp:Parameter Name="contraseña" Type="String" /> <asp:Parameter Name="escuela" Type="String" /> <asp:Parameter Name="correo" Type="String" /> <asp:Parameter Name="sexo" Type="String" /> <asp:Parameter Name="curso" Type="String" /> <asp:Parameter Name="calificacion" Type="String" /> <asp:Parameter Name="cr1" Type="String" /> <asp:Parameter Name="p1" Type="String" /> <asp:Parameter Name="cf1" Type="String" /> <asp:Parameter Name="cr2" Type="String" /> <asp:Parameter Name="p2" Type="String" /> <asp:Parameter Name="cf2" Type="String" /> <asp:Parameter Name="cr3" Type="String" /> <asp:Parameter Name="p3" Type="String" /> <asp:Parameter Name="cf3" Type="String" /> <asp:Parameter Name="boleta" Type="String" /> </UpdateParameters> </asp:SqlDataSource> </div> </form> </body> </html>
Código:
espero me puedan ayudar porque ya estoy por tirar la toalla Imports System.Data.SqlClient Imports System.Data Partial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim a As String a = "2011600000" Using cnx As New SqlConnection(Me.SqlDataSource1.ConnectionString) Dim cmd2 As New SqlCommand("SELECT nombre, boleta FROM Alumnos WHERE (p1=@cedula or p2=@cedula or p3=@cedula) AND (cr1='301' or cr2='301' or cr3='301') ", cnx) cnx.Open() Dim t As New DataSet Dim da As New SqlDataAdapter(cmd2) cmd2.Parameters.AddWithValue("@cedula", a) da.Fill(t) GridView1.DataSource = t.Tables(0) GridView1.DataBind() End Using End Sub Protected Sub GridView1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.PreRender End Sub Protected Sub GridView1_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GridView1.RowCancelingEdit GridView1.EditIndex = -1 GridView1.DataBind() End Sub Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing GridView1.EditIndex = e.NewEditIndex GridView1.DataBind() End Sub Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating End Sub End Class