Showing posts with label member. Show all posts
Showing posts with label member. Show all posts

Wednesday, March 21, 2012

Row of Table, to a Variable

I'm a new member of forum,
I'm a Brazilian, and don't speak english very good...
But, i need help...
private void Page_Load(object sender, System.EventArgs e)
{
string ConnectionString = "server=Server;database=db;userid=XXX;pwd=YYY";
string CommandText = "SELECT * FROM usuario";
SqlConnection myConnection = new SqlConnection(ConnectionString);
SqlCommand myCommand = new SqlCommand(CommandText, myConnection);
myConnection.Open();
dgrid.DataSource =myCommand.ExecuteReader(CommandBehavior.CloseConnection);
dgrid.DataBind();
}

I'm want pass a value of database table to a variable, how to make it ?
You could look at datasets instead of readers
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDataDataSetClassTopic.asp?frame=true

Wednesday, March 7, 2012

Rounding Calculated Member

I have the following calculated member that is being used to create Offline/Local cubes.

CALCULATE;

CREATE MEMBER CURRENTCUBE.[MEASURES].[Percentage]

AS Case

When IsEmpty( [Measures].[Event Count] )

Then 0

Else ((

[EE Event Template Type Dim].[Event Types].CurrentMember,

[Measures].[Event Count]) /

( [EE Event Template Type Dim].[Event Types].[(All)].[All],

[Measures].[Event Count]

)*100)

End,

FORMAT_STRING = "###.##%",

BACK_COLOR = 12632256 /*Silver*/ ,

FORE_COLOR = 16744576 /*R=128, G=128, B=255*/ ,

VISIBLE = 1 ;

I'm looking for a way to round the result. The FORMAT_STRING functionality does not carry over when I create the local cube so I end up with values like 28.90909097.

Any suggestions would be appreciated.

Tristan

Tristan,

Have you tried the "format" function?

Format(

Case

When IsEmpty( [Measures].[Event Count] )

Then 0

... rest of case statement from original calculation

,"###.##%")

|||That did the trick! Much Thanks!