user2064520
user2064520

Reputation: 31

.Net equivalent of VB6 Recordset

I want to know the equivalent of vb recordset in .net?

Which ado.net object can be used to replace vb recordset?

Upvotes: 3

Views: 5316

Answers (1)

Mitch Wheat
Mitch Wheat

Reputation: 300529

There is no direct replacement in ADO.NET for a VB6 recordset. It depends what you want to use it for, but candidates are

A very basic example would be:

    public DataSet GetDataset(string sql, string connectionString)
    {
        DataSet ds = new DataSet();

        using (SqlConnection sqlConn = new SqlConnection(connectionString))
        {
            using (SqlDataAdapter adapter = new SqlDataAdapter(sql, sqlConn))
            {
                adapter.Fill(ds);
            }
        }
        return ds;
    }

You should also take a look at:

Upvotes: 2

Related Questions