Sub ss()
'access
'Db = "d:\zcgl.mdb"
' connstr = "DBQ=" + Db + "DefaultDir=DRIVER={Microsoft Access Driver (*.mdb)}"
' Set conn = CreateObject("ADODB.Connection")
' conn.Open connstr
'删除sql对应的行
'conn.Execute "delete from grjbxx00 where 订单编号=" &Cells(1, 1) &"and 产品编号=" &Cells(2, 1)
'sql2000,你需要修改 数据库名,用户名,密码,数据表名
ConnectionString = "Driver={SQL Server}Server=(local)Datebase=dbefanUid=efanPwd=123456"
Set cnn = server.CreateObject("ADODB.Connection")
cnn.Open ConnectionString
'删除sql对应的行,grjbxx00要修改
cnn.Execute "delete from grjbxx00 where 订单编号=" &Cells(1, 1) &"and 产品编号=" &Cells(2, 1)
End Sub
删除/插入 (delete/insert) 利用的是CurrentDb.Execute(stSql)。代码如下:
[plain] view plaincopy
'拼写删除指定PR Number的SQL文
stSql = "DELETE FROM [000_BASTS] WHERE [PR NR] = '" &pr_nr &"'"
'执行SQL文
CurrentDb.Execute (stSql)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)