Showing posts with label class. Show all posts
Showing posts with label class. Show all posts

Tuesday, March 20, 2012

change datasource with sqlReportingService2005 class

hi pro , i created model project with .net 2005 after that , create report with reportbuilder that it use this model. it s ok.

i have project and i want to change datasource (connection string ) in runtime when User click on report ,i use sqlReportingService2005 class :

Dim rs As New ReportingService2005()

rs.Credentials = System.Net.CredentialCache.DefaultCredentials

Dim definition As New DataSourceDefinition()
definition.CredentialRetrieval = CredentialRetrievalEnum.Integrated
definition.ConnectString = "Data Source=" & serverName & ";Initial Catalog=" & DataBaseName & ";Integrated Security=True"
definition.Enabled = True
definition.EnabledSpecified = True
definition.Extension = "SQL"
definition.ImpersonateUser = False
definition.ImpersonateUserSpecified = False ' True
definition.Prompt = Nothing
definition.WindowsCredentials = True ' False

Try
rs.SetDataSourceContents("/Data Sources/" & DataSourceName, definition)

Catch ex As SoapException
Console.WriteLine(ex.Detail.OuterXml)
End Try
End Sub

error "An unhandled exception of type 'System.Net.WebException' occurred in System.Web.Services.dll

Additional information: The request failed with HTTP status 404: Object Not Found." happend

( i checked Enable Unmanged code debugging =true)

please help me

tanks

This error occurs only when the report server URL is given wrong or does not exists. Do check your report server URL assigned to the rs.Url property.

|||

tanks for reply. i was forgotten to say : i have 2 machin ,the first one uses Windows 2003 Server and i installed sql server on it , another machin uses windows a xp and i run project on it( it s like client). when i take project on sql server 2005 it s work nice but when i run project on xp it dosent work.

|||

Are you able to open the report server url in browser?

Sunday, February 19, 2012

CDE IDataReader Question

We've extended the IDataReader class to allow the ability to select data from multiple datasources as DataTables and then combine the multiple DataTables into one single DataTable.

Here's our internal object array that holds the values being returned to SSRS

-

internal object[] m_cols;

-

Here's our IDataReader.Read() implementation where we attempt to sort our DataTable after the combination takes place.

-

bool Microsoft.ReportingServices.DataProcessing.IDataReader.Read()
{
DataView dv = new DataView(masterTable);
dv.Sort = "CLIENT ASC";

int colCounter = 0;
while (rowCounter < dv.Table.Rows.Count)
{
if (dv.Table.Rows != null)
{
foreach (DataColumn dc in dv.Table.Columns)
{
m_cols[colCounter] = dv.Table.Rows[rowCounter].ItemArray[colCounter].ToString();
colCounter++;
}
rowCounter++;
return true;
}
}
return false;
}

Here's our IDataReader.GetValue() implemtation that returns data to the SSRS Report Designer

-

object Microsoft.ReportingServices.DataProcessing.IDataReader.GetValue(int fieldIndex)
{
return m_cols[fieldIndex];
}

It's returning data to our SSRS designer, but it's not sorted..

I can't understand it...but it's pretty important that I get this figured out fast...

thanks

doug

> It's returning data to our SSRS designer, but it's not sorted..

Not sure what you mean with that. Does the original query specify an explicit sort order?

Note that even if the original dataset is not sorted, you can apply sorting directly in the report (e.g. on a data region or on a group) - but sorting the data directly in the dataset query generally yields better performance.

-- Robert

Sunday, February 12, 2012

Casting

Hello,
I created a custom assembly with some business logic and attachted it to a
report.
A class in the assemby has an indexer defined which should return a string.
When I call the indexer from the code block I alway get an "Specified cast is
not valid" error back.
I created a test program in VS to test the classes and the indexer there
everything works fine.
What am I missing?
QSolved it.
I called a method on my class like the following:
wga.Attributes.Add("BG_CODE", Report.Parameters("Conc_BG").Value)
The definition for the Add method is:
public void Add(string databaseColumnName, string value)
But I have also another Add method which is:
public void Add(object key, object value)
I have to implement this method because my class inherits from IDictionary
I was under the impression that when I am adding strings the method with the
strings signature would be taken. But this was not the case. Instead the Add
method with the object signature was taken. Therefore my collection was
filled with objects and the indexer expected strings.
To solve this I had to rewrite it like the following:
wga.Attributes.Add("BG_CODE".ToString,
Report.Parameters("Conc_BG").Value.ToString)
Now the Add method with the strings signature is called.
Long live VS debugging!
Q
"Qbee" wrote:
> Hello,
> I created a custom assembly with some business logic and attachted it to a
> report.
> A class in the assemby has an indexer defined which should return a string.
> When I call the indexer from the code block I alway get an "Specified cast is
> not valid" error back.
> I created a test program in VS to test the classes and the indexer there
> everything works fine.
> What am I missing?
> Q