R
Ryan Ternier
Don't ask why it's coded this way.. the clueless developer before me
coded things upside down and insideout :\
Anyways,
We have a simple SQL Query that reads a table into a DataSet.
Here's the way the query is being built:
strSQL = "SELECT FirstName + ' ' + LastName as TextField, UserID AS
ValueField FROM tblStaff " & _
"WHERE CanBeAssigned = 1"
If Not objUtil.Session("blnSystemUser") Then
strSQL &= " AND UserName <> 'icompass' "
End If
strSQL &= " UNION " & _
"SELECT D.Name + ' - ' + S.FirstName + ' ' + S.LastName as
TextField, S.UserID AS ValueField " & _
"FROM tblStaff S, tblDepartments D " & _
"WHERE S.MainContact = 1 " & _
"AND S.DepartmentID = D.DepartmentID "
If Not objUtil.Session("blnSystemUser") Then
strSQL += " AND S.UserName <> 'icompass' "
End If
strSQL += " ORDER BY TextField "
dadSQL.SelectCommand.CommandText = strSQL
dadSQL.Fill(dstData, "tblItemStaffResponsible")
-------
'Binding
lstOwner.DataSource = objDataIn.DataSet
lstOwner.DataMember = "tblItemStaffResponsible"
lstOwner.DataTextField = "TextField"
lstOwner.DataValueField = "ValueField"
lstOwner.DataBind()
When it hits lstOwner.DataBind() It will catch an exception that tells me:
Message "Specified argument was out of the range of valid values.
Parameter name: value"
-----
The query that is ran returns these results:
------------------
TextField ValueField
Jake Sysadmone 2
Ryan Ternier 16
Any suggestions on why it's hitting the Catch?
coded things upside down and insideout :\
Anyways,
We have a simple SQL Query that reads a table into a DataSet.
Here's the way the query is being built:
strSQL = "SELECT FirstName + ' ' + LastName as TextField, UserID AS
ValueField FROM tblStaff " & _
"WHERE CanBeAssigned = 1"
If Not objUtil.Session("blnSystemUser") Then
strSQL &= " AND UserName <> 'icompass' "
End If
strSQL &= " UNION " & _
"SELECT D.Name + ' - ' + S.FirstName + ' ' + S.LastName as
TextField, S.UserID AS ValueField " & _
"FROM tblStaff S, tblDepartments D " & _
"WHERE S.MainContact = 1 " & _
"AND S.DepartmentID = D.DepartmentID "
If Not objUtil.Session("blnSystemUser") Then
strSQL += " AND S.UserName <> 'icompass' "
End If
strSQL += " ORDER BY TextField "
dadSQL.SelectCommand.CommandText = strSQL
dadSQL.Fill(dstData, "tblItemStaffResponsible")
-------
'Binding
lstOwner.DataSource = objDataIn.DataSet
lstOwner.DataMember = "tblItemStaffResponsible"
lstOwner.DataTextField = "TextField"
lstOwner.DataValueField = "ValueField"
lstOwner.DataBind()
When it hits lstOwner.DataBind() It will catch an exception that tells me:
Message "Specified argument was out of the range of valid values.
Parameter name: value"
-----
The query that is ran returns these results:
------------------
TextField ValueField
Jake Sysadmone 2
Ryan Ternier 16
Any suggestions on why it's hitting the Catch?