Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm trying to bind an sp to a combobox with the dropdown style. I've created a connection and a sqlDataAdapter.. but my code doesn't seem to work...

 

Imports System.Data

Imports System.Data.SqlClient

 

 

Public Class Form3

Inherits System.Windows.Forms.Form

 

Dim myConnection As SqlConnection = New SqlConnection("server=(local);database=dts;uid=sa;password=notwhatImshowing")

Dim myAdapter As SqlDataAdapter = New SqlDataAdapter("spPackageName", myConnection)

Dim myDS As DataSet

Dim WithEvents myDV As DataView

 

 

 

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

Me.ComboBox1.DropDownStyle = ComboBoxStyle.DropDown

With Me

.myDS = New DataSet

.myAdapter.Fill(myDS)

.myDV = New DataView(myDS.Tables("spPackageName"))

.ComboBox1.DataSource = myDS

.myConnection.Open()

.myConnection.Close()

 

 

End With

 

End Sub

 

 

End Class

 

 

Sql I know.. vb.net I'm just trying to learn. Any help would be great.

JvCoach23

VB.Net newbie

MS Sql Vet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...