【问题标题】:what is the dao equivalent to inserting and editing records in c# .net?什么是相当于在 c# .net 中插入和编辑记录的 dao?
【发布时间】:2011-11-14 23:03:37
【问题描述】:

我想知道在 C# 中是否有等效于 DAO 样式的插入和更新记录代码。例如,在访问 VBA 时,我可以使用如下方式进行插入:

dim db As DAO.Database
dim rs As DAO.Recordset

Set db = CurrentDatabase
Set rs = db.OpenRecordset("tableName")

With rs
     .add
     .Fields("column1") = Textbox.Value
     .update
End With

C# .net 中有类似的东西吗?我知道如何使用参数化查询来做到这一点,但对于我正在做的事情,似乎旧的 DAO 方式会更快。

【问题讨论】:

    标签: c# insert dao


    【解决方案1】:

    由于 VB.Net 和 C# .Net 共享相同的框架... .Net 这很容易。它看起来像:

    DAO.Database db = CurrentDatabase(); 
    DAO.Recordset rs = db.OpenRecordset("tableName");
    
    rs.add();
    rs.Fields["column1"] = Textbox.Value ;
    rs.update();
    

    【讨论】:

    • 是的,但 DAO 参考在哪里?
    猜你喜欢
    • 1970-01-01
    • 2023-04-07
    • 1970-01-01
    • 2015-07-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-13
    相关资源
    最近更新 更多