Showing posts with label display. Show all posts
Showing posts with label display. Show all posts

Tuesday, March 27, 2012

Help with booleans with UPDATE command.

Hello,

I'm using a Gridview to display a list of servers. Each server has a column in a table called "Enabled." I want to create a button that is supposed to toggle the value called "Enabled." I am able to make the button either to set Enabled to true or false, but I don't know how to make it toggle.

Here is the command:

UpdateCommand="UPDATE [ServerStatus] SET [Enabled] = 1 WHERE [ServerName] = @.ServerName"

The button is a buttonfield in the gridview:

<asp:ButtonField ButtonType="Button" CommandName="Update" HeaderText="Toggle" ShowHeader="True" Text="Toggle" />

Does anyone know the syntax, or a way to make the button set Enabled to true when it is false, and false when it is set to true?

UPDATE [ServerStatus]SET [Enabled] =CASE [Enabled]WHEN 1THEN 0ELSE 1END WHERE [ServerName] = @.ServerName
That should work for you if you want SQL Server to do the toggling.|||

Works like a charm.

Thanks dude.

Wednesday, March 21, 2012

Help with a simple Query

I am trying to make a single display page for an author's books.

the books page only displays books of a type "type" (novels, non-fiction, etc)

I would like to make it so that it can also show all books if "type" isn't selected. I THOUGHT the string would look like this:

<asp:SqlDataSource ID="SqlDSBooks" runat="server" ConnectionString="<%$ ConnectionStrings:csK2Reader%>" SelectCommand="SELECT * FROM [Books] ( If @.Type <> "" then WHERE ([Type] = @.Type)) ORDER BY [SortDate] DESC">

But it doesn't seem to want to work. I get a "server tag is not well formed" error.

Try this:

SELECT*FROM [Books]WHERE (@.TypeISNULLOR [Type]=@.Type)ORDERBY [SortDate]DESC

|||

Or, for text variables:

SELECT*FROM [Books]WHERE [Type] like IsNull(@.Type,'%')ORDERBY [SortDate]DESC

That is not, by the way, an exact equivalent of the previous poster's query.

This version allows a wildcard search, whereas the other query requires an exact match.

For example, if you were wanting to search for both Novels and Novellas, a value for @.Type of 'Novel%' would get you both types of book in one query.

Numbers and dates don't work this way. :(

Sunday, February 19, 2012

Help required on Mouse over display on stacked column charts

Is there a way to get markers on the top of each graph of a stacked column chart?

Also i need to display a label when the mouse points over each of the marker, as well as each partition of the graph. Getting the tooltips to work might b a help but it is not working for me. I got a reply that enabling the mouse over in the report viewer might help, but i dont know how to enable

I still say that Dundas charts are the way for you to go. You are asking for features that I seriously doubt can be achieved using reporting services.

By the way, there are rumors that Dundas charting will be in SQL 2008.