This question is locked. New answers and comments are not allowed.
OK so I am new to both .NET 3.5 and Winforms. I have experience connecting to a db in the web.config file, but when it comes to the app.config, I am having difficulty.
I am trying to populate the ComboBox with data from a Stored Procedure.
Can anyone point me in the right direction, I think I must be close.
I am trying to populate the ComboBox with data from a Stored Procedure.
Can anyone point me in the right direction, I think I must be close.
| Imports System |
| Imports System.Data |
| Imports System.Configuration |
| Imports System.Data.SqlClient |
| Imports System.Data.CommandType |
| Public Class Form_Donations |
| Private Sub Form_Donations_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
| Dim Conn As SqlConnection = New SqlConnection(ConnStr) |
| Dim sqlcmd As SqlCommand = New SqlCommand("npoGetHousehold_NameID", Conn) |
| sqlcmd.CommandType = StoredProcedure |
| Conn.Open() |
| Dim rs As SqlClient.SqlDataReader |
| rs = sqlcmd.ExecuteReader() |
| If rs.HasRows Then |
| Try |
| RadComboBox2.DataSource = rs |
| RadComboBox2.DisplayMember = "Name" |
| RadComboBox2.ValueMember = "ID" |
| Catch ex As Exception |
| End Try |
| Conn.Close() |
| Conn.Dispose() |
| End If |
| End Sub |