嗨,我正在尝试使用excel中的vba删除mysql数据库中的所有行。
我已经尝试了很多代码,得到的最接近的是以下代码,但是我仍然在语法错误:
rsmysql.Open rsstr, coninc
有人可以帮助我更正代码,所以请使其正常工作。
Dim rsmysql As ADODB.Recordset 'Holds records
Dim rsstr As String
Dim coninc As String
Set cnmysql = New ADODB.Connection
Set rsmysql = New ADODB.Recordset
coninc = "Driver={MySQL ODBC 5.3 ANSI Driver};Server=" & _
Server_Name & ";Database=" & Database_Name & _
";Uid=" & User_ID & ";Pwd=" & Password & ";"
rsstr = "delete * from TLHMember_List;"
cnmysql.Open coninc
rsmysql.Open rsstr, coninc
MsgBox "Data has been deleted"
Exit Sub
最佳答案
rsstr = "delete from TLHMember_List"
cnmysql.Open coninc
cnmysql.Execute rsstr
MsgBox "Data has been deleted"
关于mysql - Excel Vba问题从mysql数据库删除行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50440396/