Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 在aspx页面的sql查询中访问查询字符串变量_Asp.net_Mysql_Gridview - Fatal编程技术网

Asp.net 在aspx页面的sql查询中访问查询字符串变量

Asp.net 在aspx页面的sql查询中访问查询字符串变量,asp.net,mysql,gridview,Asp.net,Mysql,Gridview,我对asp.net非常陌生,我正在构建一个应用程序,需要在网格视图中显示,现在我正在生成一个查询,用于从数据库中获取数据,其中包含一个来自查询字符串的参数。我正在使用以下代码 <asp:SqlDataSource runat="server" ID="MySQLData" ConnectionString="server=localhost;port=3309; User Id=xxxxx;password=xxxxx;database=xxxxx" ProviderN

我对asp.net非常陌生,我正在构建一个应用程序,需要在网格视图中显示,现在我正在生成一个查询,用于从数据库中获取数据,其中包含一个来自查询字符串的参数。我正在使用以下代码

  <asp:SqlDataSource runat="server" ID="MySQLData"
    ConnectionString="server=localhost;port=3309; User Id=xxxxx;password=xxxxx;database=xxxxx"
    ProviderName="MySql.Data.MySqlClient"
    SelectCommand="SELECT contenthead.lastmodifieddate,contenthead.heading,lk_technology.technology FROM contenthead JOIN lk_technology WHERE contenthead.techID=lk_technology.techID AND contenthead.authorid='<%=Request.QueryString["uid"]%>'" />

现在,当我使用标记时,我得到的解析器错误是:服务器标记不能包含构造。

现在我想从查询字符串中使用此变量。请告诉我如何在此上下文中访问此变量。


<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="..."  ProviderName="System.Data.SqlClient" SelectCommand="SELECT [UserId], [LastUpdatedDate] FROM [vw_aspnet_Profiles] WHERE ([UserId] = @UserId)">
<SelectParameters>
<asp:QueryString ParameterDefaultValue="0" Name="UserId" QueryStringField="Id" Type="Object"/>
</SelectParameters>
</asp:SqlDataSource>

您必须向SqlDataSource添加一个参数

谢谢您的回复。.但我收到了此错误,请查看此url:(这是我的测试服务器。)请在asp:QueryStringParameter和DefaultValue以及asp:QueryStringParameter的其他属性之间留出空间