Combo Datasource problem, 1st time OK, 2nd time Not

  • Thread starter Thread starter GW
  • Start date Start date
G

GW

VS2003 1.1 WinXP Pro

dta = Nothing

dta = New System.Data.SqlServerCe.SqlCeDataAdapter("SELECT product,
description FROM PRODUCTS WHERE category = " & Chr(39) & sCATG & Chr(39),
cn)

dts = Nothing

dts = New DataSet

dta.Fill(dts, "INPT")



cboPROD.Items.Clear()



cboPROD.DataSource = dts.Tables("INPT") 'Argument exception the 2nd time
this is called to match the products to the category

cboPROD.ValueMember = "product"

cboPROD.DisplayMember = "description"



The first time this is called the combo displayes the correct number of
products for the category passed.

When the category changes, and we call this again, we get an exception as
per inline above.

Tried cboPROD.DataSource = nothing before setting the datasource but same
result.

Any hints?



Thks, GW
 
Correction:

VS2003 1.1 WinXP Pro

dta = Nothing

dta = New System.Data.SqlServerCe.SqlCeDataAdapter("SELECT product,
description FROM PRODUCTS WHERE category = " & Chr(39) & sCATG & Chr(39),
cn)

dts = Nothing

dts = New DataSet

dta.Fill(dts, "PRODUCTS")



cboPROD.Items.Clear()



cboPROD.DataSource = dts.Tables("PRODUCTS") 'Argument exception the 2nd
time
this is called to match the products to the category

cboPROD.ValueMember = "product"

cboPROD.DisplayMember = "description"



The first time this is called the combo displayes the correct number of
products for the category passed.

When the category changes, and we call this again, we get an exception as
per inline above.

Tried cboPROD.DataSource = nothing before setting the datasource but same
result.

Any hints?



Thks, GW
 
Back
Top