> What are the codes for linking data in VB.Net project with Microsoft Access 2010?

What are the codes for linking data in VB.Net project with Microsoft Access 2010?

Posted at: 2014-12-18 
as you already has the link, try this...

using System;

using System.Collections.Generic;

using System.Data;

using System.Windows.Forms;

using System.Data.OleDb;

namespace YahooProjects.WinClient

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

InitialiseComponent();

}

private void InitialiseComponent()

{

PopulateCountry();

}

private void PopulateCountry()

{

ICountryService service = new CountryService();

cboCountry.DataSource = service.FindAllCountries();

}

}

public interface ICountryService

{

IList FindAllCountries();

}

public class CountryService : ICountryService

{

public IList FindAllCountries()

{

IList countries = new List();

String connectionString = ConfigurationManager.ConnectionStrings[ "DefaultConnection"].ConnectionString;

using (OleDbConnection con = new OleDbConnection(connectionString))

{

String cmdText = "SELECT name FROM countries ORDER BY 1";

using (OleDbCommand com = new OleDbCommand(cmdText, con))

{

con.Open();

com.CommandType = CommandType.Text;

OleDbDataReader dr = com.ExecuteReader();

while (dr.Read())

{

countries.Add(dr["name"].ToString());

}

con.Close();

}

}

return countries;

}

}

}

34, 63, 22, 11.

Don't tell anyone, but we just call it code. :D

I created an Apartment Sales Reservation system using VB.Net in Visual Studio 2010. I have already linked it, but I need to know the codes so that I can for example, import data from a field in the database into a combo box in VB.Net.

Please help me.