需要语法帮助,asp:SqlDataSource

本文关键字:asp SqlDataSource 帮助 语法 | 更新日期: 2023-09-27 18:07:56

我在为我的SqlDataSource获得语法正确方面遇到了麻烦。我使用mySQL数据库和连接字符串是在网络。配置文件。我有这个:

<asp:SqlDataSource ID="sdsEditEvents" runat="server" 
    ConnectionString = <%$ ConnectionStrings["mySQLConnectionString"] %>
    SelectCommand="SELECT EventID, EventName, EventDate FROM Events ORDER BY EventID" 
    ProviderName="MySql.Data.MySqlClient" 
    onselected="sdsShelfLifeMaster_Selected">
</asp:SqlDataSource>

我的错误是"The server tag is not well format ."

有谁能给我指个方向吗?

需要语法帮助,asp:SqlDataSource

你忘了加引号了。

<asp:SqlDataSource ID="sdsEditEvents" runat="server"
    ConnectionString ='<%$ ConnectionStrings["mySQLConnectionString"] %>'
    SelectCommand="SELECT EventID, EventName, EventDate FROM Events ORDER BY EventID" 
    ProviderName="MySql.Data.MySqlClient" 
    onselected="sdsShelfLifeMaster_Selected">
</asp:SqlDataSource>