Hi All,
This is likely a breeze of a question, but I am still stuck in ASP Classic, and trying hard to get on the ASP.Net bandwagon.
Anyway, I have a web page with a dropdown list ...
<aspropDownList id="states" runat="server" AutoPostBack="True" DataTextField="ClientState" DataValueField="ClientState"></aspropDownList>
By the way the reason I have the text field and the data field the same is because it just retunrs a list of states found in the data. The SQL that fills this list is....
strSQL= "SELECT ClientState From tblClients Group By ClientState Order By ClientState"
That works fine. Here is the problem--when a selection is made from the list the postback is to pull client records for the selected state. I have these statements...
strSQL= "SELECT * FROM tblClients Where ClientState='" & states & "' Order By ClientLastName"
objCommand2 = New OleDbCommand(strSQL, objConnection)
objDataReader2 = objCommand2.ExecuteReader(CommandBehavior.CloseConnection)
When a state is selected The page returns this error...
Compiler Error Message: BC30452: Operator '&' is not defined for types 'String' and 'System.Web.UI.WebControls.DropDownList'.
I don't understand what is wrong with &. Is there some other concatenation operator? Is there something wrong about the value being returned from the states dropdownlist?
Thanks!
This is likely a breeze of a question, but I am still stuck in ASP Classic, and trying hard to get on the ASP.Net bandwagon.
Anyway, I have a web page with a dropdown list ...
<aspropDownList id="states" runat="server" AutoPostBack="True" DataTextField="ClientState" DataValueField="ClientState"></aspropDownList>
By the way the reason I have the text field and the data field the same is because it just retunrs a list of states found in the data. The SQL that fills this list is....
strSQL= "SELECT ClientState From tblClients Group By ClientState Order By ClientState"
That works fine. Here is the problem--when a selection is made from the list the postback is to pull client records for the selected state. I have these statements...
strSQL= "SELECT * FROM tblClients Where ClientState='" & states & "' Order By ClientLastName"
objCommand2 = New OleDbCommand(strSQL, objConnection)
objDataReader2 = objCommand2.ExecuteReader(CommandBehavior.CloseConnection)
When a state is selected The page returns this error...
Compiler Error Message: BC30452: Operator '&' is not defined for types 'String' and 'System.Web.UI.WebControls.DropDownList'.
I don't understand what is wrong with &. Is there some other concatenation operator? Is there something wrong about the value being returned from the states dropdownlist?
Thanks!