TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Violeta Popa
NA
137
164.4k
filling combobox with datatable
Apr 17 2013 1:18 PM
Hi :) I'm trying to fill a combobox with a datatable, but i don't know what's wrong, because it doesn't display any item. This is the code:
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename='C:\\Users\\Vio\\Desktop\\Gestiune asigurari auto\\Gestiune asigurari auto\\Resources\\asigurari.mdf';Integrated Security=True;Connect Timeout=30;User Instance=True";
conn.Open();
string selectClient = "SELECT * FROM client WHERE UPPER(SUBSTRING(denumire, 1, 2)) = 'RO' and tip_client='altul'";
SqlDataAdapter da = new SqlDataAdapter(selectClient, conn);
DataTable dt = new DataTable();
da.Fill(dt);
for (int i = 0; i < dt.Rows.Count; i++)
{
comboBox1.Items.Add(dt.Rows[i]["denumire"]);
}
conn.Close();
the connection works fine, i've tested it.
Reply
Answers (
4
)
serialPort1.WriteLine error
Validation Advice Please.....