This is also a sample code - try this too

santhosh kumar replied to rana pranav at 03-Jul-08 07:01
    Hi,

   Check this out ;-

Public strConn As String = "data source=xx.xx.xxx.xxx; User ID=xxxxxx; Password=xxxxxx; Persist Security Info=True;packet size=4096"

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

Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
Dim cmd As New SqlCommand("DELETE FROM Customers WHERE FirstName = '" & txtFirstName.Text & "'", New SqlConnection(strConn))
cmd.Connection.Open()
cmd.ExecuteNonQuery()
cmd.Connection.Close()
LoadData()
End Sub

Sub LoadData()
Dim strSQL As String = "Select * From Customers"
Dim cmd As New SqlCommand(strSQL, New SqlConnection(strConn))
cmd.Connection.Open()
Repeater1.DataSource = cmd.ExecuteReader
Repeater1.DataBind()
cmd.Connection.Close()
cmd.Connection.Dispose()
End Sub
End Class

   Regards,
   Santhosh


Click here to sign in and reply. You could earn money via our $500 contest just for being helpful.
  Problem - rana pranav  03-Jul-08 06:37 6:37:25 AM
      solution to delete prob - Umapathy Kaliaperumal  03-Jul-08 06:46 6:46:49 AM
      Check this code and apply - santhosh kumar  03-Jul-08 06:59 6:59:01 AM
      This is also a sample code - try this too - santhosh kumar  03-Jul-08 07:01 7:01:26 AM
View Posts