开发者

Update MAS Access Table

I have a VB6 application. The back end is MS Access. I have to execute a Update query. What is the easiest way to do so? I can not use the DOCmd option somehow. I dnt know the exact refernce needed to enable the DoCmd option. Can any one help me out.

Thanks in Adva开发者_JAVA百科nce


There are two main ways of working with data in VB6 they are ADO and DAO. All things being equal, DAO will be relatively (though not necessarily absolutely) faster with JET. ADO gives you more functionality (full access to ACE's multi-valued types excepted) and offers an improved, flatter object model.

For this example we will use ADO. This is a sample of code that fires a delete command to delete a record with a given Message_ID

With adoFlash_delete_CMD
    .ActiveConnection = adoConnection
    .CommandType = adCmdText
    .CommandText = "DELETE FROM tblFlash_messages WHERE Message_ID=?"
    .Parameters.Append .CreateParameter("@ID", adInteger, adParamInput, 0, lMessage_ID)
End With

adoFlash_delete_CMD.Execute

Set adoFlash_delete_CMD = Nothing

You should be able to look at this example and tweak it for your needs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜