namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); cmboItemType(); } private void Form1_Load(object sender, EventArgs e) { } private void cmboItemType() //for combobox { string connstr = @"Server=.\SQLEXPRESS ;Initial Catalog=RPSJDB;Integrated Security=True; Max Pool Size=100"; SqlConnection conn = new SqlConnection(connstr); SqlCommand cmd = new SqlCommand("SELECT cmbItemType FROM ItemTable", conn); conn.Open(); SqlDataReader sdr = cmd.ExecuteReader(); ArrayList ItemStore = new ArrayList(); while (sdr.Read()) { ItemStore.Add(sdr.ToString()); } sdr.Close(); conn.Close(); } } } }
namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); cmboItemType(); } private void Form1_Load(object sender, EventArgs e) { } private void cmboItemType() //for combobox { string connstr = @"Server=.\SQLEXPRESS ;Initial Catalog=RPSJDB;Integrated Security=True; Max Pool Size=100"; SqlConnection conn = new SqlConnection(connstr); SqlCommand cmd = new SqlCommand("SELECT cmbItemType FROM ItemTable", conn); conn.Open(); SqlDataReader sdr = cmd.ExecuteReader(); ArrayList ItemStore = new ArrayList(); int i=0; while (sdr.Read()) { ItemStore.Add(sdr[i].ToString()); i++; } sdr.Close(); conn.Close(); } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)