开发者

Question about using DBAccess

开发者 https://www.devze.com 2023-02-10 13:46 出处:网络
I need to use dbaccess to to write a sql database to a dataset in c#. I am not quite sure how to do this. Does anyo开发者_JS百科ne know of any good tutorials or have any advice on how to do this? Let

I need to use dbaccess to to write a sql database to a dataset in c#. I am not quite sure how to do this. Does anyo开发者_JS百科ne know of any good tutorials or have any advice on how to do this? Let me know if you need more info from me. Any help is appreciated. Thanks


Here's the nigh-canonical example:

var sql = "SELECT * FROM myTable";

using (var connection = new SqlConnection(connectionString)
{
    connection.Open();

    var command = new SqlCommand(sql, connection);

    var adapter = new SqlDataAdapter(command);

    var dataSet = new DataSet();

    adapter.Fill(dataSet);
}

"connectionString" is the provider specific string which enables the system to connection to your database. If you don't know what this should be, here's a good place to start: Connectionstrings.com.

Once you're ready to move to the next level beyond this, look at Entity Framework or NHibernate. HTH.


This ate the link you can start of:

C# Station ADO.NET

ADO>net c#

MSDN

Regards... All this tutorial helps and easy to learn..

0

精彩评论

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