Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
| Search | Today's Posts | Mark Forums Read
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 4th, 2011, 05:37 PM
Authorized User
Points: 285, Level: 5
Points: 285, Level: 5 Points: 285, Level: 5 Points: 285, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: , , .
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Visual Studio 2005 VB Data Bindings

Hi All,

I am hoping someone can help, it's been a while since I've posted on here and it's been even longer since I've been programming.

Basically I've created a Login Screen and what I'd like to do is the following:

When the login form loads the User Combobox is populated from a users table in SQL. The Selected Item would be "USERNAME" field in the user table and the Selected Value would be the "USERID" field.

Code:
Dim cnTransportSystem As New SqlClient.SqlConnection("Data Source=EXAPPSRV02;Initial Catalog=TransportSystem;Persist Security Info=True;User ID=systemadmin;Password=*********")
Dim cmdUserList As New SqlClient.SqlCommand("SELECT USERID, USERNAME FROM USERS ORDER BY USERNAME", cnTransportSystem)
Dim drUserList As SqlClient.SqlDataReader

cnTransportSystem.Open()
drUserList = cmdUserList.ExecuteReader()
ComboBox1.DataSource = drUserList
ComboBox1.SelectedItem = "USERNAME"
ComboBox1.SelectedValue = "USERID"
drUserList.Close()
cnTransportSystem.Close()
Unfortunately this is not working and I could really do with some guidance from you guys.

This is a Windows Application which I'm creating.

THanks again!!!




Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Studio 2005 - VB Windows Mobile 6 Application testsubject Visual Studio 2005 0 December 20th, 2010 12:06 PM
Visual studio 2005(32 bit) code not work in visual studio 2008 on windows server 2008 gr8.jain Visual Basic 2008 Essentials 1 August 31st, 2009 10:07 AM
Deploy CR with Visual Studio 2005 VB.Net clflyer Crystal Reports 0 March 7th, 2007 12:41 PM
Visual Studio 2003 vs. Visual Studio 2005 eitanbarazani C# 2005 4 May 9th, 2006 01:34 AM
Visual Studio .net2003 and Visual Studio 2005 Gert Visual C++ 1 January 24th, 2006 05:10 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.