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
}
public class CountryService : ICountryService
{
public IList
{
IList
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.