using System;
using System.Windows.Forms;
//---------------------------------
using System.Data;
using System.Data.SqlClient;

namespace _ex_17_38
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            string strConn = "Server=.;" + "DataBase=MyTestDB;" +
                 "Integrated Security=True";

            string strDA = "Select Last_Name From Info";

            SqlConnection sCon = new SqlConnection(strConn);
            SqlDataAdapter sda = new SqlDataAdapter(strDA, sCon);
            DataSet ds = new DataSet();
            sCon.Open();
            sda.Fill(ds, "table1");
            sCon.Close();

            foreach (DataRow dr in ds.Tables["table1"].Rows)
                comboBox1.Items.Add(dr["Last_Name"]);
        }
    }
}