G
Guest
I'm creating a component that contains a function. This function is to return
a data set of state values (AL,IL,TN,CA,...). I'm new to dataadapters this is
my first, but something just doesn't seem right.
the function return a dataset, but do it need to define a dataset in the
body of the function as well as in the calling routine?
2. can i bind this dataset to two different drop down lists?
here is my function.
Public Class states
Inherits System.ComponentModel.Component
Public Function GetStates() As DataSet
Dim ddlStates As DataSet = New DataSet
Dim strcon As String = "DSN=SE;"
Dim conSE As New OdbcConnection(strcon)
Dim strSQL As String = "select staStateName, staLongName from sta
where 1=1 order by staStateName"
Dim daStates As OdbcDataAdapter
daStates = New OdbcDataAdapter(strSQL, conSE)
'Fill dataset
conSE.Open()
daStates.Fill(ddlStates, "states")
conSE.Close()
Return ddlStates
End Function
a data set of state values (AL,IL,TN,CA,...). I'm new to dataadapters this is
my first, but something just doesn't seem right.
the function return a dataset, but do it need to define a dataset in the
body of the function as well as in the calling routine?
2. can i bind this dataset to two different drop down lists?
here is my function.
Public Class states
Inherits System.ComponentModel.Component
Public Function GetStates() As DataSet
Dim ddlStates As DataSet = New DataSet
Dim strcon As String = "DSN=SE;"
Dim conSE As New OdbcConnection(strcon)
Dim strSQL As String = "select staStateName, staLongName from sta
where 1=1 order by staStateName"
Dim daStates As OdbcDataAdapter
daStates = New OdbcDataAdapter(strSQL, conSE)
'Fill dataset
conSE.Open()
daStates.Fill(ddlStates, "states")
conSE.Close()
Return ddlStates
End Function