SelectCommand="SELECT * FROM tbl_1 WHERE 1 AND _SU LIKE ?"I need extract with query only first two characters in the string DataValueField.
Quote
SelectCommand="SELECT * FROM tbl_1 WHERE _SU like '%' + ? + '%'"
Server Error in '/' Application.
--------------------------------------------------------------------------------
ERROR [42000] [MySQL][ODBC 5.1 Driver][mysqld-5.0.45-community-nt]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '+ 'XQ00' + '%'' at line 1
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.Odbc.OdbcException: ERROR [42000] [MySQL][ODBC 5.1 Driver][mysqld-5.0.45-community-nt]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '+ 'XQ00' + '%'' at line 1
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnMySQL %>"
ProviderName="<%$ ConnectionStrings:ConnMySQL.ProviderName %>"
SelectCommand="SELECT * FROM tbl_1 WHERE 1 LIMIT 0,4"
DataSourceMode="DataSet">
</asp:SqlDataSource>
<p>dropdownlist #1
<asp:DropDownList ID="DropDownList1" runat="server" Visible="true"
DataSourceID="SqlDataSource1"
AutoPostBack="True"
DataTextField="_DU"
DataValueField="_SU">
<asp:ListItem>SELECT ONE VALUE</asp:ListItem>
</asp:DropDownList>
</p>
<asp:sqldatasource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnMySQL %>"
ProviderName="<%$ ConnectionStrings:ConnMySQL.ProviderName %>"
SelectCommand="SELECT * FROM tbl_1 WHERE 1 AND _SU like ?"
DataSourceMode="DataSet">
<selectparameters>
<asp:controlparameter Name="_SZ" ControlID="DropDownList1" PropertyName="SelectedValue" Direction="Input" />
</selectparameters>
</asp:sqldatasource>
<p>dropdownlist #2
<asp:DropDownList ID="DropDownList2" runat="server" Visible="true"
DataSourceID="SqlDataSource2"
AutoPostBack="True"
DataTextField="_DU"
DataValueField="_SZ">
</asp:DropDownList>
</p>
| Subject | Written By | Posted |
|---|---|---|
| Problem with dynamic DropDownList | Chevy Mark Sunderland | 01/31/2012 11:26AM |
| Re: Problem with dynamic DropDownList | dave lilley | 02/03/2012 12:09AM |
Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.