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

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

        private void Form1_Load(object sender, EventArgs e)
        {
            listBox1.RightToLeft = RightToLeft.Yes;

            string strConn = "Server=.;" + "DataBase=MyTestDB;" +
                             "Integrated Security=True";
            
            SqlConnection sCon = new SqlConnection(strConn);
            SqlCommand sc = new SqlCommand("Select Last_Name From Info", sCon);
            sc.Connection.Open();
            SqlDataReader dr = sc.ExecuteReader();
            
            while (dr.Read())
                listBox1.Items.Add(dr["Last_Name"]);
            
            sc.Connection.Close();
        }
    }
}