Reputation: 651
I am new in VB.net, sql and even phpmyadmin gui. I want to delete records saved in my phpmyadmin but I got an error when executing sqlcommand's executenonquery()
This is my code used in VB.NET:
Public Sub RetrieveInfos(ByRef SQLStatement As String)
Dim cmd As MySqlCommand = New MySqlCommand
With cmd
.CommandText = SQLStatement
.CommandType = CommandType.Text
.Connection = SQLConnection
.ExecuteNonQuery()
End With
'--read the records in database in phpmyadmin gui---
Dim myReader As MySqlDataReader = cmd.ExecuteReader
If myReader.Read Then
lblName.Text = myReader.GetString(0)
lblAge.Text = myReader.GetString(1)
End If
myReader.Close()
SQLConnection.Close()
MsgBox("Records Successfully Retrieved")
SQLConnection.Dispose()
End Sub
Private Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
Dim SQLStatement As String = "DELETE FROM patient WHERE 1"
RetrieveInfos(SQLStatement)
End Sub
Any help would be appreciated. Thanks!
Upvotes: 2
Views: 1501
Reputation: 2575
To delete data from phpmyadmin, As specified in phpMyAdmin setting that you need to edit in config.inc.php.
boolean $cfg['AllowUserDropDatabase'] (line 503)
show a 'Drop database' link to normal users
Upvotes: 1