如何在phpmyadmin中删除数据库记录?

时间:2012-07-26 17:06:09

标签: mysql vb.net phpmyadmin

我是VB.net,sql甚至是phpmyadmin gui的新手。我想删除保存在我的phpmyadmin中的记录但是在执行sqlcommand的executiontenonquery()时出错了

这是我在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

任何帮助将不胜感激。谢谢!

1 个答案:

答案 0 :(得分:1)

从phpmyadmin删除数据,如phpMyAdmin setting中指定的那样,您需要在config.inc.php中编辑。

boolean $cfg['AllowUserDropDatabase'] (line 503)

show a 'Drop database' link to normal users