纳撒尼尔·德洛斯·雷耶斯 [英] nathaniel delos reyes

查看:45
本文介绍了纳撒尼尔·德洛斯·雷耶斯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


如何编辑和删除数据库中的数据

how to edit and delete data in database

推荐答案

在这个名为 Quick 的论坛中,这可能是太笼统的问题,无法回答&答案.好吧,使用ADO.NET.

从这里开始:
http://en.wikipedia.org/wiki/ADO.NET [ http://msdn.microsoft.com/en-us/library/aa286484.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/h43ks021%28v = vs.100%29.aspx [ ^ ].

-SA
This is probably too general question to answer in this forum named Quick Questions & Answers. Well, use ADO.NET.

Start here:
http://en.wikipedia.org/wiki/ADO.NET[^],
http://msdn.microsoft.com/en-us/library/aa286484.aspx[^],
http://msdn.microsoft.com/en-us/library/h43ks021%28v=vs.100%29.aspx[^].

—SA


public const string DB_CONN_STRING = 
        "Driver={Microsoft Access Driver (*.mdb)}; "+
        "DBQ=D:\\CS\\TestDbReadWrite\\SimpleTest.mdb";


    // Edit SQL command
    String sSQLCommand = "UPDATE Person SET Age = 27 WHERE FirstName = 'Peter'";
    // Create the command object
    ADOCommand cmdAdder = new ADOCommand(
        sSQLCommand,
        DB_CONN_STRING);
    cmdAdder.ActiveConnection.Open();
    // Execute the SQL command
    int nEdit = cmdAdder.ExecuteNonQuery();
    System.Console.WriteLine( "\nRow(s) Added = " + nEdit + "\n" );


    // Delete SQL command
    String sSQLCommand = "DELETE FROM Person WHERE FirstName = 'Bobo'";
    // Create the command object
    ADOCommand cmdAdder = new ADOCommand(
        sSQLCommand,
        DB_CONN_STRING);
    cmdAdder.ActiveConnection.Open();
    // Execute the SQL command
    int nDel = cmdAdder.ExecuteNonQuery();


这篇关于纳撒尼尔·德洛斯·雷耶斯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆