2

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

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

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

4

1 回答 1

1

要从 phpmyadmin 中删除数据,如 phpMyAdmin 设置中指定的,您需要在 config.inc.php 中进行编辑。

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

show a 'Drop database' link to normal users
于 2013-07-19T07:49:50.737 回答