Asked by:
Data Source Configuration Wizard

Question
-
User-389313458 posted
I'm am not sure if I used the DSCW correctly to construct my SQL statement.
I wanted to write SELECT InvoiceNumber FROM Invoices WHERE Total > 300.
Here is my code for my Data Source Control.
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT InvoiceNumber FROM Invoices WHERE (Total > ?)"> <SelectParameters> <asp:Parameter DefaultValue="300" Name="Total" Type="Decimal" /> </SelectParameters> </asp:SqlDataSource>
Monday, February 11, 2013 4:30 PM
All replies
-
User-1716253493 posted
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT InvoiceNumber FROM Invoices WHERE (Total > @Total)"> <SelectParameters> <asp:Parameter DefaultValue="300" Name="Total" Type="Decimal" /> </SelectParameters> </asp:SqlDataSource>
Monday, February 11, 2013 7:40 PM -
User-389313458 posted
Can you explain how to do this in the Data Configuration Wizard. When I'm in the Add WHERE clause dialog box, I do these steps:
1.) Column: Total
2.) Operator: >
3.) Source: None
4.) Value: 300
SQL Expression:
[Total] > ?
Why do I get a question mark? How do I get @Total to appear?
Monday, February 11, 2013 9:39 PM -
User-1716253493 posted
I try using wizard, > is encoded character, that worked.
WHERE ([testfield] > @testfield)
http://msdn.microsoft.com/en-us/library/ms525347(v=vs.90).aspx
Monday, February 11, 2013 9:55 PM -
User-389313458 posted
Did you follow the same steps that I listed above? Why would I get a question mark and you got @Total if we followed the same steps?
Tuesday, February 12, 2013 2:13 PM -
User3866881 posted
Hi,
Your screenshot, please.
Saturday, February 16, 2013 9:21 PM