Last post Apr 15, 2011 11:52 PM by Decker Dong - MSFT
Apr 09, 2011 01:17 PM|vbkid|LINK
This is really easy, but I can't seem to get this working correctly...
When using SqlDataSource and press on Configure Data Source, I have selected my data source.
I have selected * all records and pressed the WHERE button (so it starts to bulld a query).
I have set the following values:
Column: NewOrUsed (only contains 1 of 2 values, either "New" or "Used")
QueryString Field: (Eval("NewOrUsed").ToString)
Default Value: New
However it doesn't seem to work, always returns no records even though I know there are a number of records matching "New"
What am I doing wrong?
Apr 09, 2011 09:51 PM|WombatEd|LINK
Could you please post all your related markup and code?
(It makes things a lot more readable if you use the Insert Code tool. If you need instructions, see this
How to use the Forums' "Insert Code" tool post.)
Apr 09, 2011 10:14 PM|vbkid|LINK
Sorry this isn't code, I have done nothing yet except add add a SqlDataSource control and then from the Tool, pressed on Configure Data Source, then selected my database named ComputerShop as the data source.
From that point I am still within the configuration wizard, I have not entered a single line of code at this point:
I then select * all records from a table named ComputerSales in the database and then pressed the WHERE button.
After pressing the WHERE button I am still within the wizard and I then fill in the following options:
So basically from this, I am trying to select fieldname NewOrUsed from the database ComputerShop tablename ComputerSales, where the String in the fieldname NewOrUsed is evaluated, and I am searching for all records which are indicated to be "New".
But no results are displayed even though there are a lot of new items.
So this is where I am right now. Is that any clearer?
Apr 10, 2011 01:29 AM|WombatEd|LINK
I don't work in Design mode, so I can't help you unless you show me the markup.
All the designer really does is create markup, which you can view (and post) by clicking on the "Source" tab below your designer window.
Apr 11, 2011 10:09 PM|Decker Dong - MSFT|LINK
I notice that your queryString Field is Eval（……）, I'm afraid this is your problem
QueryString Field is the something looking like XXX.asp?id=1——Here's the id called by us as "QueryStringField".
So if you use Eval("NewOrUsed").ToString, the querystring field will become something looking like:
Apr 12, 2011 03:39 AM|vbkid|LINK
If I think I'm understanding you correctly Decker Dong...
So Eval("NewOrUsed").ToString treats values like a Boolean?
I am not sure, as although it prompts me in the wizard, I have used this before to evaluate what is in the text and output it. At least I think I have?
Apr 15, 2011 11:52 PM|Decker Dong - MSFT|LINK
In my mind after considering for a period of time. I think it will regard "Eval("NewOrUsed").ToString" as a whole querystring field.