S
sck10
Hello,
I have two dropdown objects that I want to use the same datasource for each.
I tried the following, but it doesn't populate the second dropdown. Do I
need to close the OleDbDataReader and then re-open it to populate the second
dropdown object?
Thanks in advance,
sck10
'Populate the TerminationType combo box
'--------------------------------------
Dim spTerminationType As OleDb.OleDbDataReader
Dim prmTermType As OleDbParameter
Dim cmdTermType As New OleDb.OleDbCommand("spMySearch", cnnSearch)
cmdTermType.CommandType = CommandType.StoredProcedure
prmTermType = cmdTermType.Parameters.Add("@strParm01", OleDbType.VarChar)
: prmTermType.Value = "FindTerminationType"
prmTermType = cmdTermType.Parameters.Add("@strParm02", OleDbType.VarChar)
: prmTermType.Value = "NoParameter"
prmTermType = cmdTermType.Parameters.Add("@strParm03", OleDbType.VarChar)
: prmTermType.Value = "NoParameter"
prmTermType = cmdTermType.Parameters.Add("@strParm04", OleDbType.VarChar)
: prmTermType.Value = "NoParameter"
spTerminationType = cmdTermType.ExecuteReader()
'TerminationType 1
Me.ddlTerminationType1.DataSource = spTerminationType
Me.ddlTerminationType1.DataTextField = "TerminationType_ID"
Me.ddlTerminationType1.DataBind()
'TerminationType 2
Me.ddlTerminationType2.DataSource = spTerminationType
Me.ddlTerminationType2.DataTextField = "TerminationType_ID"
Me.ddlTerminationType2.DataBind()
spTerminationType.Close() : spTerminationType = Nothing
I have two dropdown objects that I want to use the same datasource for each.
I tried the following, but it doesn't populate the second dropdown. Do I
need to close the OleDbDataReader and then re-open it to populate the second
dropdown object?
Thanks in advance,
sck10
'Populate the TerminationType combo box
'--------------------------------------
Dim spTerminationType As OleDb.OleDbDataReader
Dim prmTermType As OleDbParameter
Dim cmdTermType As New OleDb.OleDbCommand("spMySearch", cnnSearch)
cmdTermType.CommandType = CommandType.StoredProcedure
prmTermType = cmdTermType.Parameters.Add("@strParm01", OleDbType.VarChar)
: prmTermType.Value = "FindTerminationType"
prmTermType = cmdTermType.Parameters.Add("@strParm02", OleDbType.VarChar)
: prmTermType.Value = "NoParameter"
prmTermType = cmdTermType.Parameters.Add("@strParm03", OleDbType.VarChar)
: prmTermType.Value = "NoParameter"
prmTermType = cmdTermType.Parameters.Add("@strParm04", OleDbType.VarChar)
: prmTermType.Value = "NoParameter"
spTerminationType = cmdTermType.ExecuteReader()
'TerminationType 1
Me.ddlTerminationType1.DataSource = spTerminationType
Me.ddlTerminationType1.DataTextField = "TerminationType_ID"
Me.ddlTerminationType1.DataBind()
'TerminationType 2
Me.ddlTerminationType2.DataSource = spTerminationType
Me.ddlTerminationType2.DataTextField = "TerminationType_ID"
Me.ddlTerminationType2.DataBind()
spTerminationType.Close() : spTerminationType = Nothing