select * from variable
クエリでRequest.QueryStringを変数に設定するにはどうすればよいですか?ここで変数からselect *内の変数にRequest.QueryStringを設定する方法
は、私はそれをやろうとしています方法です:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:conn %>" SelectCommand="SELECT [pm1], [s1], [i1], [j1] FROM ([pk1] = @pk1)">
<SelectParameters>
<asp:QueryStringParameter Name="pk1" QueryStringField="pk1" DbType = "String" Direction = "Input" />
</SelectParameters>
</asp:SqlDataSource>
をしかし、これは私に次のエラー与える:あなたのクエリ内のQueryString値を取得するために
Incorrect syntax near '='.
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.SqlClient.SqlException: Incorrect syntax near '='.
SQLの定義は間違っています: 'SELECT FROM table'は正しいですが、' SELECT fields FROM table = param1'ではありません。 何か不足していますか? – Marco
私はテーブルからURLのパラメータを使用したい – ragnat