Zdravím, vyhledávám v databázi podle QueryStringu, ale hází mi to tuto chybu: Formát inicializačního řetězce neodpovídá specifikaci počínaje indexem 0 Poradil by mi prosím někdo, co je v kódu špatně?
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="DeskriptivaConnectionString"
SelectCommand="SELECT * FROM [Videos] WHERE ([VideoName] LIKE '%' + @Query + '%')">
<SelectParameters>
<asp:QueryStringParameter Name="Query" QueryStringField="q" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1" GroupItemCount="3" GroupPlaceholderID="groupPlaceholder" ItemPlaceholderID="itemPlaceholder">
<LayoutTemplate>
<table>
<asp:PlaceHolder ID="groupPlaceholder" runat="server" />
</table>
</LayoutTemplate>
<GroupTemplate>
<tr>
<asp:PlaceHolder runat="server" ID="itemPlaceholder" />
</tr>
</GroupTemplate>
<ItemTemplate>
<td>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("VideoId", "../Video/?id={0}") %>' >
<img src='<%#Eval("VideoThumbnail")%>' alt="Single Image" width="300" height="190" /></asp:HyperLink><br />
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# Eval("VideoId", "../Video/?id={0}") %>' ><h3 style="margin-bottom: 0">
<asp:Literal ID="VideoName" Mode="Encode" runat="server" Text='<%# Eval("VideoName") %>' /></h3></asp:HyperLink><small>Autor: <asp:Literal ID="UserName" runat="server" Text='<%# Eval("UserName")%>' />
<span style="float: right;"><asp:Literal ID="VideoDate" runat="server" Text='<%# Eval("VideoDate", "{0:dd/MM/yyyy}")%>' /></span></small>
</td>
</ItemTemplate>
<GroupSeparatorTemplate>
<tr>
<td>
<br />
<br/>
<br />
</td>
</tr>
</GroupSeparatorTemplate>
<ItemSeparatorTemplate>
<td width="40px">
</td>
</ItemSeparatorTemplate>
</asp:ListView>
|