将C#数据列表连接到MySQL服务器 [英] Connecting C# Datalist to MySQL server

查看:65
本文介绍了将C#数据列表连接到MySQL服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是什么(带下划线的代码)?页面正在打开,但没有打开数据

What is the problem (they code with underline)?The page is opening but not the data

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="kategori.aspx.cs" Inherits="kategori" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:DataList ID="DataList2" runat="server" DataSourceID="secilenKategori">
    </asp:DataList>
    <asp:SqlDataSource ID="secilenKategori" runat="server" 

        ConnectionString="<%$ ConnectionStrings:veritabaniConnectionString2 %>" 

        ProviderName="<%$ ConnectionStrings:veritabaniConnectionString2.ProviderName %>" 

        SelectCommand="SELECT * FROM kategoriler " FilterExpression="idkategoriler = {0}">
        <FilterParameters>
	                    <asp:QueryStringParameter QueryStringField="id" Name="idkategoriler"  />
                    </FilterParameters>    </asp:SqlDataSource>
</asp:Content>

推荐答案

ConnectionStrings:veritabaniConnectionString2 %> " span> ProviderName =" <%
ConnectionStrings:veritabaniConnectionString2 %>" ProviderName="<%


ConnectionStrings:veritabaniConnectionString2.ProviderName %> " span> SelectCommand =" SELECT * FROM kategoriler" FilterExpression =" > < FilterParameters > < asp:QueryStringParameter QueryStringField =" 名称 idkategoriler " > < /FilterParameters > < /asp:SqlDataSource > < /asp:Content >
ConnectionStrings:veritabaniConnectionString2.ProviderName %>" SelectCommand="SELECT * FROM kategoriler " FilterExpression="idkategoriler = {0}"> <FilterParameters> <asp:QueryStringParameter QueryStringField="id" Name="idkategoriler" /> </FilterParameters> </asp:SqlDataSource> </asp:Content>


我找到了正确的代码.(它们的下划线宽度)
Ihave the correct code find.(they width underline)
<![CDATA[<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="kategori.aspx.cs" Inherits="kategori" %>]]>

<asp:content id="Content1" contentplaceholderid="HeadContent" runat="Server" xmlns:asp="#unknown">
</asp:content>
<asp:content id="Content2" contentplaceholderid="MainContent" runat="Server" xmlns:asp="#unknown">
 <asp:datalist id="DataList2" runat="server" datasourceid="SqlDataSource1">
            DataKeyField="idkategoriler">
            <itemtemplate>
                idkategoriler:
                <asp:label id="idkategorilerLabel" runat="server">
                    Text='<%# Eval("idkategoriler") %>' />
                <br />
                kategoriAdi:
                <asp:label id="kategoriAdiLabel" runat="server">
                    Text='<%# Eval("kategoriAdi") %>' />
                <br />
                kategoriImg:
                <asp:label id="kategoriImgLabel" runat="server">
                    Text='<%# Eval("kategoriImg") %>' />
                <br />
                kategoriIcerik:
                <asp:label id="kategoriIcerikLabel" runat="server">
                    Text='<%# Eval("kategoriIcerik") %>' />
                <br />
<br />
            </asp:label></asp:label></asp:label></asp:label></itemtemplate>
        </asp:datalist>
        <asp:sqldatasource id="SqlDataSource1" runat="server">
            ConnectionString="<%


这篇关于将C#数据列表连接到MySQL服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆