Imports System.Data
Imports System.Data.SqlClient
Imports System.IO
Partial Class admin_student
Inherits System.Web.UI.Page
Public cn As SqlConnection
Public da As SqlDataAdapter
Public Function fillgrid()
cn = New SqlConnection("Data Source=;Initial Catalog=;User ID=;Password=")
da = New SqlDataAdapter("select * from s_reg", cn)
ds = New DataSet()
da.Fill(ds)
GridView1.DataSource = ds
GridView1.DataBind()
End Function
Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting
cn = New SqlConnection("Data Source=;Initial Catalog=;User ID=;Password=")
da = New SqlDataAdapter("select * from s_reg", cn)
Dim cmd As SqlCommandBuilder = New SqlCommandBuilder(da)
ds = New DataSet
da.Fill(ds)
ds.Tables(0).Rows(e.RowIndex).Delete()
da.Update(ds)
GridView1.DataSource = ds
GridView1.DataBind()
End Sub
No comments:
Post a Comment