Showing posts with label web. Show all posts
Showing posts with label web. Show all posts

Wednesday, March 21, 2012

Distant access to Excel file for import

Hi,

I'm developping a web application and I need to import a data from an excel file to sql server 2005.

It works very well locally (visual studio & sql server & the excel file on the same machine).

But it doesn't work when visual studio & excel file are in a machine and sql server is in another server.

I have always the same problem:

'C:\Documents and Settings\momo\Bureau\File.xls' n'est pas un chemin d'accès valide. Assurez-vous que le nom du chemin d'accès est correct et qu'une connexion est établie avec le serveur sur lequel réside le fichier.

Could any one help me please ?!

Thank you in advance.

It would help if you translated the French error message to English.

|||

Sorry to be late !

Here is the translation :

'C:\Documents and Settings\momo\Desktop\File.xls' isn't a correct access path. Be sure that the name of the access path is correct and a connexion is established with the server where is the file.

In fact, I'm using the FileUpload control as follows:

string filemap = Convert.ToString(fileupload.PostedFile.FileName);

string conString = @."Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=""Excel 8.0;HDR=YES;"";Data Source=" + filemap;

Could you tell me, please, what do I have to modify in order to be able to import my file from any client machine (of course, each client machine has a copy of the same file locally).

Thanks in advance.

|||

You need to think of a different architecture. You should create a web service that writes to the SQL Server. On each client PC you need a windows application that can read the excel spreadsheet and write to the web service.

|||

Please, could I have more details on how to do it. I'm a begginer in ASP NET and so I do not know what a web service means exactely.

Thanks.

|||

Have a look at http://quickstarts.asp.net/QuickStartv20/webservices/default.aspx and work through the tutorial

"The ASP.NET Web Services QuickStart is a series of client and server samples along with supporting commentary designed to quickly acquaint developers with featuresin ASP.NET Web Services. The QuickStart samples are designed to be short, easy-to-understand illustrations of these features. By the time you finish reviewing these samples, you will be familiar with the majorfeature areas in ASP.NET Web Services. "

displaying xml using reporting service web service

I'm using VS2005 web developer. I can't display XML results when using the
render method, although it renders fine.
I'm using the SQL Server 2000 reporting services web service render method
to get a byte array like this:
result = rs.Render(reportPath, format, historyID, devInfo,
parameters, _
credentials, showHideToggle, encoding, mimeType,
reportHistoryParameters, warnings, streamIDs)
This is from the sample at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/RSPROG/htm/rsp_ref_soapapi_service_lz_6x0z.asp
It works great if I assign HTML4.0 and EXCEL to the "format" variable.
Then I put
response.binarywrite(result)
and it is just fine.
When I try this with the XML format, it creates a file perfectly if I put
Dim stream As FileStream = File.Create("report.xml", result.Length)
but I don't know how to display the xml in a browser.
Response.binarywrite(result) and Response.writefile("report.xml") gives me
an error
The XML page cannot be displayed.
...
Cannot have a DOCTYPE declaration outside of a prolog
I guess because the XML is written inside the html.
I would appreciate any suggestions.
Thanks
BillCorrection - response.writefile(filename) works, but I don't want to have to
create files on the server and clean them up all the time.
Thanks
Bill
"bill" <belgie@.datamti.com> wrote in message
news:ubuEOCnMGHA.2124@.TK2MSFTNGP14.phx.gbl...
> I'm using VS2005 web developer. I can't display XML results when using
> the render method, although it renders fine.
> I'm using the SQL Server 2000 reporting services web service render method
> to get a byte array like this:
> result = rs.Render(reportPath, format, historyID, devInfo,
> parameters, _
> credentials, showHideToggle, encoding, mimeType,
> reportHistoryParameters, warnings, streamIDs)
> This is from the sample at
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/RSPROG/htm/rsp_ref_soapapi_service_lz_6x0z.asp
> It works great if I assign HTML4.0 and EXCEL to the "format" variable.
> Then I put
> response.binarywrite(result)
> and it is just fine.
> When I try this with the XML format, it creates a file perfectly if I put
> Dim stream As FileStream = File.Create("report.xml", result.Length)
> but I don't know how to display the xml in a browser.
> Response.binarywrite(result) and Response.writefile("report.xml") gives
> me an error
> The XML page cannot be displayed.
> ...
> Cannot have a DOCTYPE declaration outside of a prolog
> I guess because the XML is written inside the html.
> I would appreciate any suggestions.
> Thanks
> Bill
>

Monday, March 19, 2012

Displaying Reports without Report Manager & Login

I'm having a hard time believing others have not ran into this issue.
Anyway...here it is:
I've got a pretty extensive web app. that we're using SQL Reporting Services
to fullfill the reporting requirements. (This is a shared server in a server
farm...I don't have the capabilities to change security settings on the
reporting server).
So, long story short...I'd like to display the reports to the users a single
report at a time, without the report manager capabilities. I've went through
the rendering process and it would work if that is the only way to do it, but
I'd rather show them the HTML toolbar the comes with reporting services and
let them interact with the report. I realize that I can do this just by
calling a URL but when I do that it asks for a username and password. So I
guess the bottom line question is how can I open the report via the URL
without asking me for the report manager username and password (without using
the reporting services render method).
Thanks in Advance!!This sounds like a security issue between domains/machines etc.
Does the user sign in on machine 1 and then click on a link to go to machine
2 that has a different username/password? If so the user will need to enter
their username/password to get on to machine 2.
There are some work arounds but that may cause security wholes for you.
What is the exact security scenario you have?
Craig
"Nick Stineman" <NickStineman@.discussions.microsoft.com> wrote in message
news:476573EC-A15B-4F36-B6EF-EFB4ABE15E9F@.microsoft.com...
> I'm having a hard time believing others have not ran into this issue.
> Anyway...here it is:
> I've got a pretty extensive web app. that we're using SQL Reporting
> Services
> to fullfill the reporting requirements. (This is a shared server in a
> server
> farm...I don't have the capabilities to change security settings on the
> reporting server).
> So, long story short...I'd like to display the reports to the users a
> single
> report at a time, without the report manager capabilities. I've went
> through
> the rendering process and it would work if that is the only way to do it,
> but
> I'd rather show them the HTML toolbar the comes with reporting services
> and
> let them interact with the report. I realize that I can do this just by
> calling a URL but when I do that it asks for a username and password. So
> I
> guess the bottom line question is how can I open the report via the URL
> without asking me for the report manager username and password (without
> using
> the reporting services render method).
> Thanks in Advance!!|||Exact Situation...
We use a shared web server host to host our web application. We've signed
up for SQL reporting services with the host. From what I can decipher with
my e-mails to the web hosting provider the reporting services resides on a
seperate machine as the website. The reporting services server requires SSL
encryption. It is when I try and access the report manager that I am asked
for a username and password. I've created a rendering capability that spits
my reports out as PDF files...this will work if required...but I'd rather
give the end user the functionality of the HTML toolbar located within
reporting services.
If our hosting provider has made a choice or installation configuration that
is causing issues accessing via a direct URL I guess I just need to know. I
can't believe that Microsoft would roll out a product that required
additional login to simply view a report.
Thanks!!
-Nick
"Craig" wrote:
> This sounds like a security issue between domains/machines etc.
> Does the user sign in on machine 1 and then click on a link to go to machine
> 2 that has a different username/password? If so the user will need to enter
> their username/password to get on to machine 2.
> There are some work arounds but that may cause security wholes for you.
> What is the exact security scenario you have?
> Craig
>
> "Nick Stineman" <NickStineman@.discussions.microsoft.com> wrote in message
> news:476573EC-A15B-4F36-B6EF-EFB4ABE15E9F@.microsoft.com...
> > I'm having a hard time believing others have not ran into this issue.
> > Anyway...here it is:
> >
> > I've got a pretty extensive web app. that we're using SQL Reporting
> > Services
> > to fullfill the reporting requirements. (This is a shared server in a
> > server
> > farm...I don't have the capabilities to change security settings on the
> > reporting server).
> >
> > So, long story short...I'd like to display the reports to the users a
> > single
> > report at a time, without the report manager capabilities. I've went
> > through
> > the rendering process and it would work if that is the only way to do it,
> > but
> > I'd rather show them the HTML toolbar the comes with reporting services
> > and
> > let them interact with the report. I realize that I can do this just by
> > calling a URL but when I do that it asks for a username and password. So
> > I
> > guess the bottom line question is how can I open the report via the URL
> > without asking me for the report manager username and password (without
> > using
> > the reporting services render method).
> >
> > Thanks in Advance!!
>
>|||This is an IIS security issue. I think the hosting provided doesn't allow
anonymous access to the report server.
Is the website your running public domain or do users have to sign in to
that as well?
Craig
"Nick" <Nick@.discussions.microsoft.com> wrote in message
news:AC213DC2-7DAA-4B9A-8688-FB92E22426C2@.microsoft.com...
> Exact Situation...
> We use a shared web server host to host our web application. We've signed
> up for SQL reporting services with the host. From what I can decipher
> with
> my e-mails to the web hosting provider the reporting services resides on a
> seperate machine as the website. The reporting services server requires
> SSL
> encryption. It is when I try and access the report manager that I am
> asked
> for a username and password. I've created a rendering capability that
> spits
> my reports out as PDF files...this will work if required...but I'd rather
> give the end user the functionality of the HTML toolbar located within
> reporting services.
> If our hosting provider has made a choice or installation configuration
> that
> is causing issues accessing via a direct URL I guess I just need to know.
> I
> can't believe that Microsoft would roll out a product that required
> additional login to simply view a report.
> Thanks!!
> -Nick
> "Craig" wrote:
>> This sounds like a security issue between domains/machines etc.
>> Does the user sign in on machine 1 and then click on a link to go to
>> machine
>> 2 that has a different username/password? If so the user will need to
>> enter
>> their username/password to get on to machine 2.
>> There are some work arounds but that may cause security wholes for you.
>> What is the exact security scenario you have?
>> Craig
>>
>> "Nick Stineman" <NickStineman@.discussions.microsoft.com> wrote in message
>> news:476573EC-A15B-4F36-B6EF-EFB4ABE15E9F@.microsoft.com...
>> > I'm having a hard time believing others have not ran into this issue.
>> > Anyway...here it is:
>> >
>> > I've got a pretty extensive web app. that we're using SQL Reporting
>> > Services
>> > to fullfill the reporting requirements. (This is a shared server in a
>> > server
>> > farm...I don't have the capabilities to change security settings on the
>> > reporting server).
>> >
>> > So, long story short...I'd like to display the reports to the users a
>> > single
>> > report at a time, without the report manager capabilities. I've went
>> > through
>> > the rendering process and it would work if that is the only way to do
>> > it,
>> > but
>> > I'd rather show them the HTML toolbar the comes with reporting services
>> > and
>> > let them interact with the report. I realize that I can do this just
>> > by
>> > calling a URL but when I do that it asks for a username and password.
>> > So
>> > I
>> > guess the bottom line question is how can I open the report via the URL
>> > without asking me for the report manager username and password (without
>> > using
>> > the reporting services render method).
>> >
>> > Thanks in Advance!!
>>

Displaying reports in the form of graphs over web

Hi,

I have a requirement to show reports(in the form of graphs) over the web page. The reports get the data from the database. Right now I'm using GDI+ to render the graphs over the web. I want to know if there are any significant advantages of using sql server reporting services over GDI+ ?

Can I draw any kind of complex graphs using the reporting services or is there a limitation on the kind of graphs that can be drawn?

Does GDI+ have better flexibility in terms of drawing graphs or reporting service can help achieve the same thing?

Thanks much in advance.

Drawing graphs yourself will always provide you with more flexibility than using a pre-built solution. The question is: do you need this much flexibility? In most cases, the answer is no; but only you can answer that. SSRS gives you a lot. I wouldn't dare say it handles every scenario, but I haven't seen a requirement that can't be met with what SSRS provides. If you've ever used the charting in Excel, you can think of this as a somewhat similar feature-set. Honestly, tho, I'd just take the hour to create a simple report. You'll see how easy it is and what options you're given fairly quickly. Additionally, you can check out theAsp.net videos; specifically, the SQL Server 2005 Express section has two videos you might be interested in:#10 Getting Started with Reporting Services and#11 Building and Customizing Reports in Business Intelligence Development Studio.

|||

Thank you so much for the information. I got just what I needed. I need to generate graphs similar to those generated using Excel.

Reporting services seems to be the better option then. Thanks once again.

|||Glad to be able to help! A lot of people hesitate to dig into SSRS because they're worried it'll be complicated. Once you start, tho, you realize just how easy it is to get up and running. Admittedly, SSRS isn't going to solve every problem and there can be some annoying work-arounds when you start to reach more advanced reports, but it's a fantastic 80-90% solution. Best of luck with it!|||

Swetha.c,

I found a solution that has an interface that looks similar to Microsoft Excel. It is a product called AutoTag made by Windward Reports. They have an ASP.NET Engine that can run the reports you generate from AutoTag. Check it out, might be what you are looking for.

http://www.windward.net

--TR

Displaying reports

Hi All
I was wondering if there is any way of viewing reports created in reporting
services over the web without having to use Sharepoint. I do not want the
usual reports server view. I would like as close to the Sharepoint Report
Viewer web part as possible.
Many ThanksHi,
You need to write your own web part, then will solve your prob, Just check
this site as well. http://blogs.sqlxml.org/bryantlikes/default.aspx for
sharepoint reporting viewer web parts.
Amarnath
"mackaycc" wrote:
> Hi All
> I was wondering if there is any way of viewing reports created in reporting
> services over the web without having to use Sharepoint. I do not want the
> usual reports server view. I would like as close to the Sharepoint Report
> Viewer web part as possible.
> Many Thanks|||Quote:
"without having to use Sharepoint"
ie. I want to be able to display it in a browser window (Without using
Sharepoint or any web parts which run in Sharepoint)
"Amarnath" wrote:
> Hi,
> You need to write your own web part, then will solve your prob, Just check
> this site as well. http://blogs.sqlxml.org/bryantlikes/default.aspx for
> sharepoint reporting viewer web parts.
> Amarnath
>
> "mackaycc" wrote:
> > Hi All
> >
> > I was wondering if there is any way of viewing reports created in reporting
> > services over the web without having to use Sharepoint. I do not want the
> > usual reports server view. I would like as close to the Sharepoint Report
> > Viewer web part as possible.
> >
> > Many Thanks

Friday, March 9, 2012

Displaying HTML in Report

Hi
I'm using a HTHL editor in a web site which enables users to format text in
HTML format which is then stored in the database e.g.
<span style="color: #000000">* Daily Email Checks <br/>* Tape Changes
<br/>* Documentation for Accessing OWA<br/>* Refamiliarisation of Site</span>
I'm sure I read somewhere that SQL Reporting Services 2008 would enable you
to display this in HTML format but I cant seem to get it to work in the
November 2008 CTP.
Am I correct with what I've think I read or is the functionality not
available in the November CTP?
Thanks
RKPCorrect, it is not available in the November CTP.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"RKP" <RKP@.discussions.microsoft.com> wrote in message
news:7D7FF1E7-9280-44C2-B8C2-9C03D3B496E4@.microsoft.com...
> Hi
> I'm using a HTHL editor in a web site which enables users to format text
> in
> HTML format which is then stored in the database e.g.
> <span style="color: #000000">* Daily Email Checks <br/>* Tape Changes
> <br/>* Documentation for Accessing OWA<br/>* Refamiliarisation of
> Site</span>
> I'm sure I read somewhere that SQL Reporting Services 2008 would enable
> you
> to display this in HTML format but I cant seem to get it to work in the
> November 2008 CTP.
> Am I correct with what I've think I read or is the functionality not
> available in the November CTP?
> Thanks
> RKP
>|||I presume we have a CTP later than November, does that mean this
feature is now available in the latest CTP or ithis feature is still
on-hold?
On Apr 10, 5:49=A0am, "Bruce L-C [MVP]" <bruce_lcNOS...@.hotmail.com>
wrote:
> Correct, it is not available in the November CTP.
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "RKP" <R...@.discussions.microsoft.com> wrote in message
> news:7D7FF1E7-9280-44C2-B8C2-9C03D3B496E4@.microsoft.com...
>
> > Hi
> > I'm using a HTHL editor in a web site which enables users to format text=
> > in
> > HTML format which is then stored in the database e.g.
> > <span style=3D"color: #000000">* Daily Email Checks =A0 =A0<br/>* Tape C=hanges
> > <br/>* Documentation for Accessing OWA<br/>* Refamiliarisation of
> > Site</span>
> > I'm sure I read somewhere that SQL Reporting Services 2008 would enable
> > you
> > to display this in HTML format but I cant seem to get it to work in the
> > November 2008 CTP.
> > Am I correct with what I've think I read or is the functionality not
> > available in the November CTP?
> > Thanks
> > RKP- Hide quoted text -
> - Show quoted text -

Wednesday, March 7, 2012

Displaying data of a cube over web hangs up server

Hi!

Can someone give me a clue in such problem?

I have published my cube in WEB to be available for other users (using save as web page in Excel). There are no problems while everyone uses Excel or export the file from WEB to MS Office Excel. But if we use web interface and try to get data, Analysis Server hangs up. It does not happening with the same cubes if they are located on local computer, so I don't think the problem is in cube. And I realy need web interface to get data from cube.

Should I reconsider another way to publish cubes in web or check some other things?

I am currently building a class library that uses ADOMD and MDX to bring back data in a DataTable. We then send the user over to Microsoft Reporting Services (reports run off the same MDX) to display graphs and give them export options. I have not had it hang up on me though.|||

Hi,

Are you publishing the web page (saved excel page) in a web server?

If so, what credentials are being passed from IIS/web server to analysis server ?

check if that credentials have permissions in Analysis Server.

check if you have allowed interactivity while creating the excel web page?

Next use sql profiler, to find out if the request is coming thru to the analysis server.

if the request itself is not coming, it means there is some connectivity, permissions or credentials issue.

if the request is coming to analysis server, then you can debug from there on....

hope this helps

Regards

|||

Hi again!

I am assure that there is all right with connectivity and permissions. The strangest thing is that previously everything worked quite well. The problem is new with previously published cubes (which worked prpperly in web interface for a long time). The problem showed up just in past week after installing SP2 on server.

|||

Hi,

Can you open SQL profiler and find out whats happening?

we can get more details to debug this problem from there.

Regards

|||

EvaZ wrote:

The problem showed up just in past week after installing SP2 on server.

Have you installed the SP2 version of the OLEDB provider on the client machine (ie. the web server)?

|||

I should ask for this one our administrator, but I doubt it. In that case, where could I get the download?

Thank you!

|||It is part of the Feature Pack, you should find the OLE DB provider download about half way down this page: http://www.microsoft.com/downloads/details.aspx?familyid=50b97994-8453-4998-8226-fa42ec403d17&displaylang=en

Displaying data of a cube over web hangs up server

Hi!

Can someone give me a clue in such problem?

I have published my cube in WEB to be available for other users (using save as web page in Excel). There are no problems while everyone uses Excel or export the file from WEB to MS Office Excel. But if we use web interface and try to get data, Analysis Server hangs up. It does not happening with the same cubes if they are located on local computer, so I don't think the problem is in cube. And I realy need web interface to get data from cube.

Should I reconsider another way to publish cubes in web or check some other things?

I am currently building a class library that uses ADOMD and MDX to bring back data in a DataTable. We then send the user over to Microsoft Reporting Services (reports run off the same MDX) to display graphs and give them export options. I have not had it hang up on me though.
|||

Hi,

Are you publishing the web page (saved excel page) in a web server?

If so, what credentials are being passed from IIS/web server to analysis server ?

check if that credentials have permissions in Analysis Server.

check if you have allowed interactivity while creating the excel web page?

Next use sql profiler, to find out if the request is coming thru to the analysis server.

if the request itself is not coming, it means there is some connectivity, permissions or credentials issue.

if the request is coming to analysis server, then you can debug from there on....

hope this helps

Regards

|||

Hi again!

I am assure that there is all right with connectivity and permissions. The strangest thing is that previously everything worked quite well. The problem is new with previously published cubes (which worked prpperly in web interface for a long time). The problem showed up just in past week after installing SP2 on server.

|||

Hi,

Can you open SQL profiler and find out whats happening?

we can get more details to debug this problem from there.

Regards

|||

EvaZ wrote:

The problem showed up just in past week after installing SP2 on server.

Have you installed the SP2 version of the OLEDB provider on the client machine (ie. the web server)?

|||

I should ask for this one our administrator, but I doubt it. In that case, where could I get the download?

Thank you!

|||It is part of the Feature Pack, you should find the OLE DB provider download about half way down this page: http://www.microsoft.com/downloads/details.aspx?familyid=50b97994-8453-4998-8226-fa42ec403d17&displaylang=en

Displaying Data of a Cube over Web

When you use BI Dev Studio or SS Management Studio to process an Analysis Services database or object, there's a nice dialog box that shows very robust status and progress information.

Is there any way to capture this information if you are processing something programmatically? Specifically interested in both the ability to capture and display this information to a user when processing via a custom application. Also interested in whether or not there's a way to capture this information to a log (or table) for display and analysis after the fact (or if the custom application is running in a batch mode via a schedule).

Thanks,
Dave FacklerI've been looking for the same thing. Were you able to find where this information is stored/logged?

Thanks!|||One simple way to do this is using the SQL Server Profiler tool which has the option of logging trace information to files or tables as well as the UI. You can also do this programmatically using the AMO using Server.SessionTrace or by adding custom traces to Server.Traces.|||

Using the AMO, you can listen Session Trace. Sample code is following:

this.sessionTrace = server.SessionTrace;

this.sessionTrace.OnEvent += new TraceEventHandler(sessionTrace_TraceEventHandler);

this.sessionTrace.Stopped += new TraceStoppedEventHandler(sessionTrace_Stopped);

if (!this.sessionTrace.IsStarted)

{

this.sessionTrace.Start();

}

|||

You can use AMO (Microsoft.AnalysisServices.dll from "%ProgramFiles%\Microsoft SQL Server\90\SDK\Assemblies") to subscribe to trace events. Sample code below. The code formatting might be lost when posting, but copy paste in VS, and then "Edit -> Advanced -> Format Document" should fix it.

//=====================================================================
//
// File: Program.cs
// Summary: Sample code for using traces with AMO.
// Date: 2006-05-23
//
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
//=====================================================================
using System;
using Microsoft.AnalysisServices;

namespace Microsoft.AnalysisServices.CodeSamples
{
/// <summary>
/// Demonstrates use of traces with AMO.
/// </summary>
/// <remarks>
/// This code requires the "Adventure Works" database to be present on the Analysis Services server
/// and also the "AdventureWorksDW" relational database on SQL Server (for processing objects to
/// generate trace events).
/// </remarks>
class AmoTrace
{
static int Main(string[] args)
{
//--
// There are 2 types of traces that AMO programmer can use:
// - the session trace: provides the events from the current session (established
// on Connect)
// - the custom traces: they allow to choose the particular event classes and
// columns to be traced. Unlike the session trace, a custom trace needs to be
// created and saved to server explicitly (as any other AMO object, like a
// Dimension or a Cube).
//
// This is the plan of the code:
// 1. we'll connect to an Analysis Services server
// 2. we'll locate the "Product" dimension from the "Adventure Works DW" database
// (we'll process it to generate trace events)
// 3. we'll use the session trace
// 4. we'll create, use and then delete a custom trace
//--

string connectionString = "Data Source=localhost";
string databaseName = "Adventure Works DW"; // use "Adventure Works DW Standard Edition" if you have the standard edition installed

try
{
//--
// STEP 1: connect to Analysis Services server.
//--
Server server = new Server();
server.Connect(connectionString);

try
{
//--
// STEP 2: locate the "Product" dimension.
//--
Database database = server.Databases.FindByName(databaseName);
if (database == null)
{
Console.Error.WriteLine("The [{0}] database is missing.", databaseName);
return 1;
}

Dimension productDimension = database.Dimensions.FindByName("Product");
if (productDimension == null)
{
Console.Error.WriteLine("The [Product] dimension is missing.");
return 1;
}

//--
// STEP 3: use the session trace.
//--
UseSessionTrace(server, productDimension);

//--
// STEP 4. create, use and then delete a custom trace.
//--
UseCustomTrace(server, productDimension);

return 0;
}
finally
{
server.Disconnect();
}
}
catch (Exception e)
{
Console.Error.WriteLine(e.ToString());
return 1;
}
}

/// <summary>
/// Demonstrates the use of session trace.
/// </summary>
private static void UseSessionTrace(Server server, Dimension dimensionToProcess)
{
//--
// 1. Subscribe to the session trace events.
//--
SessionTrace sessionTrace = server.SessionTrace;
TraceEventHandler onTraceEvent = new TraceEventHandler(OnTraceEvent);
TraceStoppedEventHandler onTraceStopped = new TraceStoppedEventHandler(OnTraceStopped);

sessionTrace.OnEvent += new TraceEventHandler(OnTraceEvent);
sessionTrace.Stopped += new TraceStoppedEventHandler(OnTraceStopped);
sessionTrace.Start(); // this method is not blocking, it starts a separate thread to listen for events from server


//--
// 2. Process the dimension; this will generate events that we'll display to
// the Console.
//--
try
{
dimensionToProcess.Process(ProcessType.ProcessFull); // this method blocks; while processing, events are received
}
finally
{
//--
// 3. Un-subscribe from the trace.
//--
sessionTrace.Stop();
sessionTrace.OnEvent -= onTraceEvent;
sessionTrace.Stopped -= onTraceStopped;
}
}

/// <summary>
/// Demonstrates the use of a custom trace.
/// </summary>
private static void UseCustomTrace(Server server, Dimension dimensionToProcess)
{
//--
// 1. Create and save to server a custom trace with only the
// ProgressReportBegin, ProgressReportCurrent and ProgressReportEnd events
// and the EventClass and EventSubclass columns.
//--
Trace trace = server.Traces.Add(); // a Name and ID will be generated for the new Trace
TraceEvent event1 = trace.Events.Add(TraceEventClass.ProgressReportBegin);
TraceEvent event2 = trace.Events.Add(TraceEventClass.ProgressReportCurrent);
TraceEvent event3 = trace.Events.Add(TraceEventClass.ProgressReportEnd);

event1.Columns.Add(TraceColumn.EventClass);
event1.Columns.Add(TraceColumn.EventSubclass);

event2.Columns.Add(TraceColumn.EventClass);
event2.Columns.Add(TraceColumn.EventSubclass);

event3.Columns.Add(TraceColumn.EventClass);
event3.Columns.Add(TraceColumn.EventSubclass);

// Save the newly created Trace to the server; others could use it (unlike the session
// trace which is specific to a particular session).
trace.Update();


//--
// 2. Subscribe to the newly create trace.
//--
TraceEventHandler onTraceEvent = new TraceEventHandler(OnTraceEvent);
TraceStoppedEventHandler onTraceStopped = new TraceStoppedEventHandler(OnTraceStopped);

trace.OnEvent += new TraceEventHandler(OnTraceEvent);
trace.Stopped += new TraceStoppedEventHandler(OnTraceStopped);
trace.Start(); // this method is not blocking, it starts a separate thread to listen for events from server

//--
// 3. Process the dimension; this will generate events that we'll display to
// the Console.
//--
try
{
dimensionToProcess.Process(ProcessType.ProcessFull); // this method blocks; while processing, events are received
}
finally
{
//--
// 3. Un-subscribe from the trace.
//--
trace.Stop();
trace.OnEvent -= onTraceEvent;
trace.Stopped -= onTraceStopped;
}


//--
// 4. Cleanup: delete the trace from the server. We could leave it (to be used
// in the future or by other users), but we'll delete it since it was only a
// sample.
//--
trace.Drop();
}

/// <summary>
/// Event handler for trace events, called on a separate thread by the AMO trace.
/// </summary>
/// <remarks>
/// When the Start() method is called on a Trace, AMO creates a separate thread
/// that listens for events from the server; when an event is read, this method is
/// called on that thread. There should be no heavy calculations in this method
/// because the trace thread will be blocked and events might overflow the connection's
/// buffer(s), resulting in loss of events.
/// </remarks>
private static void OnTraceEvent(object sender, TraceEventArgs e)
{
Console.WriteLine("Event ({0}, {1})", e.EventClass, e.EventSubclass);
}

/// <summary>
/// Event handler for trace stop events, called on a separate thread by the AMO trace when
/// a trace is stopped (by the user, by the server or by an exception).
/// </summary>
/// <remarks>
/// There are 3 main reasons for a trace to be stopped:
/// - the user called the Stop() method
/// - the server ended the trace (because somebody deleted it meanwhile for example)
/// - an exception occured during parsing of events (because of a network disconnect for example)
/// </remarks>
private static void OnTraceStopped( ITrace sender, TraceStoppedEventArgs e )
{
Console.WriteLine("Trace Stopped: Cause = {0}, Exception = {1}", e.StopCause, e.Exception);
}
}
}

Adrian Dumitrascu.

|||Does anyone know if there is anyway of figuring out which events support which columns from the object model? At the moment I have had to resort to hard coding the columns supported by a given event.|||Thanks for all the responses and the sample code!

I would like to capture this information using SSIS. Of course, the script tasks only supports VB as well. Is there an easy way to capture trace information from the cube processing within SSIS?

Thanks again for all the help!|||

AMO doesn't provide the list of supported columns for a particular trace event. But, there are 2 other places containing the associations:

- the "tracedefinition90.xml" file (search for it in "%ProgramFiles%\Microsoft SQL Server"). You will need to parse it to generate a user-friendlier map. But please note that this file might change in the future (probably not the xml schema, but columns/events might be added/removed/changed).

- SQL Profiler; when you create a new AS2005 trace, in the 'Trace Properties' window, see the 'Events Selection' tab (generated from the trace definition file)

Adrian Dumitrascu

|||

I don't have yet a sample VB.NET code for using AMO traces, but a work-around is to have a separate assembly containing the trace code (written in C# from the sample posted previously) and use this assembly from the VB.NET script task in SSIS.

Adrian Dumitrascu

|||

You could try running the sample code through one of the online C# to VB.NET converters (eg. http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx). They are not perfect, but they can get you pretty close.

I don't know if the event handling code will work inside an SSIS script task. In this case one option might be to configure the trace to log to a file.

|||

Thanks Adrian, the tracedefinitions90.xml looks like it could be very useful.

The other thing I just found was that by going File -> Export -> Script Trace Definition. I can get an xmla script that will create the server side trace.

This might suit my needs as I can configure the trace using the profiler GUI, script it out and then just get my app to execute the xmla and then connect to the server side trace.

|||

Hi,

I have created an analysis services project using SQL Server 2005, in which I have included a cube, dimension, data source and data view. Now using the Analysis services Browser tab of cube I can see the Pivot table exactly the way I want where I can drag & drop table fields as per my requirements. But I am struggling to display the same cube over the Web. Can any please tell me that how I can publish the contents of Cube i.e. Pivot table on a web application so that end user can use this. I want the same functionality, which I can see in the Browser tab of Cube in AS2005 i.e. user should have freedom to drag & drop the fields exactly like in Excel Pivot table.

Any help would be highly appreciated.

Thanks in advance.

|||

Take a look at the following link on Mosha's website. It contains a set of links to web-based browsers and applications. You can probably use them as a guide to developing your own custom web-based app for doing this (or perhaps use one of the listed applications directly).

http://www.mosha.com/msolap/util.htm#ThinClients

HTH,

Dave Fackler

Friday, February 24, 2012

Display Reports in ASP.Net 2.0

What is the best way to display a report in ASP.Net 2.0. Are there web parts
like there are in SharePoint? Or is it that ReportViewer control? I am
running SQL 2005 Reporting Services.
Thanks,
DougSYou have three options.
1. Integrate using URL integration.
2. Integrate using web services and handle the nuts and bolts yourself
3. Use the new reportviewer control that comes with VS 2005 (it does not
come with RS 2005). This control is a major improvement over the example
(which is really all the previous one was) that shipped with RS 2000. This
control uses web services internally. My suggestion is to take a long hard
look at using this control. It is far and away the best way to integrate
with your own ASP.net application (this control is a asp.net 2.0 control).
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"DougS" <doug@.nospam.com> wrote in message
news:%23J9lY8mTGHA.1672@.tk2msftngp13.phx.gbl...
> What is the best way to display a report in ASP.Net 2.0. Are there web
> parts like there are in SharePoint? Or is it that ReportViewer control? I
> am running SQL 2005 Reporting Services.
> Thanks,
> DougS
>|||Thanks much. You're right, it is much better than the old ReportViewer.
DougS
"Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
news:ONyGdyoTGHA.5972@.TK2MSFTNGP10.phx.gbl...
> You have three options.
> 1. Integrate using URL integration.
> 2. Integrate using web services and handle the nuts and bolts yourself
> 3. Use the new reportviewer control that comes with VS 2005 (it does not
> come with RS 2005). This control is a major improvement over the example
> (which is really all the previous one was) that shipped with RS 2000. This
> control uses web services internally. My suggestion is to take a long hard
> look at using this control. It is far and away the best way to integrate
> with your own ASP.net application (this control is a asp.net 2.0 control).
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "DougS" <doug@.nospam.com> wrote in message
> news:%23J9lY8mTGHA.1672@.tk2msftngp13.phx.gbl...
>> What is the best way to display a report in ASP.Net 2.0. Are there web
>> parts like there are in SharePoint? Or is it that ReportViewer control? I
>> am running SQL 2005 Reporting Services.
>> Thanks,
>> DougS
>

Sunday, February 19, 2012

Display of SqlDataSource

I'm trying to follow along with lesson07 Web Development Express series and when I drag the SqlDataSource tool onto my form I do not see the object on the screen. I therefore can not configure it until I have placed GridView object onto my form.

I hope you can help me in how to view the SqlDataSource or inform me where I can get further informationThere is a menu option to show/hide the controls which have no display. Sorry, can't think of it off hand, but it's there.|||

Thanks;

I found it under View-Non_Visual Controls

Bruce

Friday, February 17, 2012

Display list of databases in App_Data folder

Hi All,

The web site I'm working on will allow admin users to create a new database for each new client. I'm hoping to be able to keep all of the databases in the local App_Data folder, but I'm finding that I can't even find a way of generating a list of the databases in the App_Data folder.

The code I have is:

Dim serverConnAs New ServerConnection(".\SQLEXPRESS")serverConn.LoginSecure =TrueserverConn.ConnectTimeout = 30serverConn.Connect()Dim sqlServerAs Server =New Server(serverConn)For Each dbAs DatabaseIn sqlServer.Databases ListView1.Items.Add(db.Name)Next
This does populate a list of databases, but not the ones in the App_Data folder - just those attached directly to the server.
Any help on this will be greatly appreciated as it's starting to drive me nuts!
Thanks,
Paul

Hi Paul,

What you are getting is correct. You will get a list of databases running on the server.

If you want to create databases on a particular directory you have to override the default directory

C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data or something similar depending on where is your default data directory.

You have to specify that in your create database script

USE MASTER

CREATE DATABASE DataBaseName
ON
(
NAME = LogicalName_Data,
FILENAME = 'c:\YourPath\App_Data\DataBaseName_Data.mdf',
SIZE = 4,
MAXSIZE = 10,
FILEGROWTH = 1
)
LOG ON
(
NAME = 'LogicalName_Log',
FILENAME = 'c:\YourPath\App_Data\DataBaseName_Log.ldf',
SIZE = 5MB,
MAXSIZE = 25MB,
FILEGROWTH = 5MB
)

Use

Server server = new Server(new ServerConnection(cnnDb));
server.ConnectionContext.ExecuteNonQuery(sqlString);

to create the new database.

If want to find all databases that are present in the directory.

You have to do a naming convention trick of naming the database starting with

GeneratedDb_ and filter the names based on it or

You can use DirectoryInfo class and read the App_Data folder and get all files having extension .mdf

Or loop through the filegroups in Database and check for App_Data folder

Happy programming,
Anton

|||

Hello,

this may be helpful to u

http://www.codeproject.com/aspnet/dbadmin.asp

http://www.codeproject.com/aspnet/MyDbViewerSite.asp

|||

Hi guys,

Just wanted to say a big thank you for your replies. It looks like this is tougher than I expected as I don't think I can get away with updating the master database to force the creation of the databases (ultimately, the web app won't be loaded on my server), and I had loved the idea of using '|DataDirectory|' so that I didn't need to explicitly give the server name for the connection strings already created. However, I think I've read enough now to believe that I am better off setting things to work directly with the server rather than locally - at least I seem to be able to create new databases and copy data as I need to.

Thanks again,

Paul

Display IP address from client in a report

I know that may seem like a weird request, but bear with me. I have multiple possible web sites that would request a report from a given Report Server, and I'd like the IP address of whatever machine requested the report to be displayed somewhere on said report. Is there a way to achieve this?

Thank you!

NOTE: To simplify things, I literally want to display whatever IP the reporting server sees. No need to think complicated about if its a server, a client, etc. Just whatever IP the report server is seeing.

You can use a parameter in query string that contain IP address of the server macchine that require the report.

|||

You can get a client's IP address by:

string GetIPAddress(){return HttpContext.Current.Request.UserHostAddress;}

You can put this code in a custom assembly. You can call this assembly in your report:http://geekswithblogs.net/davyknuysen/archive/2007/03/26/109901.aspx

|||

I thought about embedding code, but unfortunately, the Request object is not set in a report (had to import System.web in it first to test that).

And sending the IP as a parameter would be the easy way, with a catch: Servers tend to have a lot of IPs, even more so if you include the IPv6 ones. Its difficult to "guess" which one is exposed to the server. Can do some tricks using subnet masks and such, but the ideal would be for the server to find it, itself.

My plan B is to have a config in machine.config or something (multiple apps need it, not just web) with the IP as a key, and we'll have to make sure not to forget to change it, or something...