Horje
connect to a database and loop over a recordset in C# Code Example
connect to a database and loop over a recordset in C#
using System.Data.OleDb;
...

using (OleDbConnection conn = new OleDbConnection())
{
    conn.ConnectionString = "Provider=sqloledb;Data Source=yourServername\\yourInstance;Initial Catalog=databaseName;Integrated Security=SSPI;";

    using (OleDbCommand cmd = new OleDbCommand())
    {
        conn.Open();
        cmd.Connection = conn;
        cmd.CommandText = "Select * from yourTable";

        using (OleDbDataReader dr = cmd.ExecuteReader())
        {
            while (dr.Read())
            {
                Console.WriteLine(dr["columnName"]);
            }
        }
    }
}




Csharp

Related
get innermost exception c# Code Example get innermost exception c# Code Example
when creating a new boolean column in an existing table how to set the default value as true in c# models code first Code Example when creating a new boolean column in an existing table how to set the default value as true in c# models code first Code Example
If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. Code Example If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. Code Example
unity sprite blurry when far Code Example unity sprite blurry when far Code Example
unity exenerate Code Example unity exenerate Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10