Link to home
Start Free TrialLog in
Avatar of dejandejanovic
dejandejanovic

asked on

ComboBox won't populate by stored procedur with parameter. Need someone to check code.

Hello,
same as title question. I would be pleased if someone show me, why my code won't popualte combobox by sql stored procedure.

 Dim newAdapater As SqlDataAdapter
                Dim tbl As New DataTable
                Dim conProc As New SqlConnection
                Dim cmdProc As New SqlCommand
                conProc.ConnectionString = DB
                conProc.Open()
                cmdProc.Connection = conProc
                cmdProc.CommandText = "GetState"
                cmdProc.CommandType = Data.CommandType.StoredProcedure
                cmdProc.Parameters.Add("IsoCodes", Data.SqlDbType.NVarChar, 500).Value = "US"
                newAdapater = New SqlDataAdapter(cmdProc)
                newAdapater.Fill(tbl)
                Me.ComboBoxState.DataSource = tbl
                Me.ComboBoxState.DisplayMember = "StateName"

Open in new window


Thank you in advance for help.
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dejandejanovic
dejandejanovic

ASKER

Ok, yes code is working. I'm leaveing this post for other members ot help with it.

Mistake was really dummy, so I would not comment.

Thanks for quick reply, and test on your site.