below is my code, the problem is when i click the button it does not give any responce, i don;t what is the mistake
please see my code below:
If e.CommandName = "DeleteData" Then
Dim IdPelajarDelete As String = e.CommandArgument.ToString()
Dim mySQLConnection = New SqlConnection()
mySQLConnection.ConnectionString = ConfigurationManager.ConnectionStrings("default").ConnectionString
mySQLConnection.Open()
Dim cmd As New SqlCommand()
cmd.Connection = mySQLConnection
cmd = New SqlCommand("delete from MaklumatPelajar where IdPelajar=" + IdPelajarDelete + "", mySQLConnection)
mySQLConnection.Close()
mySQLConnection.Open()
Dim cmd As New SqlCommand()
cmd.Connection = mySQLConnection
cmd = New SqlCommand("delete from MaklumatPelajar where IdPelajar=" + IdPelajarDelete + "", mySQLConnection)
cmd.ExcuteNonQuery()
mySQLConnection.Close()
afastars
Member
52 Points
221 Posts
Programmatically Delete Data From Gridview
Jan 04, 2013 02:11 PM|LINK
below is my code, the problem is when i click the button it does not give any responce, i don;t what is the mistake
please see my code below:
If e.CommandName = "DeleteData" Then Dim IdPelajarDelete As String = e.CommandArgument.ToString() Dim mySQLConnection = New SqlConnection() mySQLConnection.ConnectionString = ConfigurationManager.ConnectionStrings("default").ConnectionString mySQLConnection.Open() Dim cmd As New SqlCommand() cmd.Connection = mySQLConnection cmd = New SqlCommand("delete from MaklumatPelajar where IdPelajar=" + IdPelajarDelete + "", mySQLConnection) mySQLConnection.Close()Specs
Member
612 Points
149 Posts
Re: Programmatically Delete Data From Gridview
Jan 04, 2013 02:16 PM|LINK
Add your aspx page code
oned_gk
All-Star
31515 Points
6433 Posts
Re: Programmatically Delete Data From Gridview
Jan 04, 2013 02:29 PM|LINK
ramramesh
Member
458 Points
158 Posts
Re: Programmatically Delete Data From Gridview
Jan 04, 2013 02:32 PM|LINK
You missed Command.ExcuteNonQuery()
for change it
mySQLConnection.Open() Dim cmd As New SqlCommand() cmd.Connection = mySQLConnection cmd = New SqlCommand("delete from MaklumatPelajar where IdPelajar=" + IdPelajarDelete + "", mySQLConnection) cmd.ExcuteNonQuery() mySQLConnection.Close()afastars
Member
52 Points
221 Posts
Re: Programmatically Delete Data From Gridview
Jan 05, 2013 01:14 AM|LINK
hi ramramesh
you resolve my problem, i got it, rushing to resolve this probelm