473,770 Members | 6,133 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Programmaticall y deploy SQL server 2005 reports and Datasource

5 New Member
Hi,

I am working on a Installer Project, which requires to deploy SQL Server 2005 Reports (.rdl files) and Datasource (.rds file). The datasource is common for all reports. The report files are available in multiple folders (under D:\TestReport) and the .rds file is in a folder called 'Data Sources'. I wrote a VB.Net console application to do the task. I am able to deploy the report files under the specified folders. But I don't know how to deploy the rds file and assign that datasource to the report files.

I have created s datasource based on the input. The datasource is created, but when I browse the reports, the error "The report server cannot process the report. The data source connection information has been deleted. (rsInvalidDataS ourceReference) " appears. Herewith I have attached the code I used. Somebody please help me in this regard.

Thanks,

Bala

Expand|Select|Wrap|Line Numbers
  1. Module Module1
  2.     Sub Main(ByVal Arg() As String)
  3.         Try
  4.             'If Arg.Length < 5 Then Exit Sub
  5.             Dim DBServer As String = "Server" 'Arg(0)
  6.             Dim DBName As String = "DBName" 'Arg(1)
  7.             Dim ReportServerURL As String = "http://localhost/ReportServer1/ReportService2005.asmx" 'Arg(2)
  8.             Dim ReportsParentFolder As String = "C:/TestReport" 'Arg(3)
  9.             Dim ReportParentFolderName As String = "DB Reports"  'Arg(4)
  10.  
  11.             Dim RServices As New ReportingService2005.ReportingService2005()
  12.             RServices.Credentials = System.Net.CredentialCache.DefaultCredentials
  13.             RServices.Url = ReportServerURL
  14.             RServices.CreateFolder(ReportParentFolderName, "/", Nothing)
  15.  
  16.             Dim ReportPath As String = ""
  17.             Dim ReportDef() As Byte
  18.             Dim DirInfo As New DirectoryInfo(ReportsParentFolder)
  19.             Dim CurrentFolderName As String = ReportsParentFolder
  20.             Dim CurReportFolderName As String = "/" & ReportParentFolderName
  21.  
  22.             ' Create datasource for the report.
  23.             Dim dDefinition As New ReportingService2005.DataSourceDefinition()
  24.             dDefinition.Extension = "SQL"
  25.             dDefinition.ConnectString = "Data Source=" + DBServer + ";Initial Catalog=" + DBName
  26.             dDefinition.ImpersonateUser = False
  27.             dDefinition.ImpersonateUserSpecified = True
  28.             dDefinition.Prompt = Nothing
  29.             dDefinition.WindowsCredentials = True
  30.             dDefinition.CredentialRetrieval = ReportingService2005.CredentialRetrievalEnum.Store
  31.             dDefinition.Enabled = True
  32.             dDefinition.EnabledSpecified = True
  33.             dDefinition.UserName = ""
  34.             dDefinition.Password = ""
  35.             dDefinition.WindowsCredentials = True
  36.  
  37.             For Each RdlFile As FileSystemInfo In DirInfo.GetFileSystemInfos
  38.                 If RdlFile.GetType.Name = "DirectoryInfo" Then ' it is a folder
  39.                     RServices.CreateFolder(RdlFile.Name, "/" & ReportParentFolderName, Nothing)
  40.                     CurrentFolderName = ReportsParentFolder & "/" & RdlFile.Name
  41.                     CurReportFolderName = CurReportFolderName & "/" & RdlFile.Name
  42.  
  43.                     Dim DirInfo1 As New DirectoryInfo(RdlFile.FullName)
  44.                     For Each RdlFile1 As FileSystemInfo In DirInfo1.GetFileSystemInfos
  45.                         If RdlFile1.GetType.Name <> "DirectoryInfo" Then
  46.                             ReportPath = RdlFile1.Name
  47.                             Dim File As New FileStream(CurrentFolderName & "/" & ReportPath, FileMode.Open)
  48.                             ReportDef = New Byte(File.Length) {}
  49.                             File.Read(ReportDef, 0, CInt(File.Length))
  50.                             File.Close()
  51.  
  52.                             If LCase(Mid(RdlFile1.Name, RdlFile1.Name.Length() - 2)) = "rdl" Then
  53.                                 RServices.CreateReport(ReportPath.Remove(ReportPath.Length - 4, 4), CurReportFolderName, True, ReportDef, Nothing)
  54.                             End If
  55.                             If LCase(Mid(RdlFile1.Name, RdlFile1.Name.Length() - 2)) = "rds" Then
  56.                                 RServices.CreateDataSource("ReportData", "/" & ReportParentFolderName & "/Data Sources", False, dDefinition, Nothing)
  57.                             End If
  58.  
  59.                         End If
  60.                     Next
  61.                 Else ' it is a rdl file
  62.                     ReportPath = RdlFile.Name
  63.                     Dim File As New FileStream(CurrentFolderName, FileMode.Open)
  64.                     ReportDef = New Byte(File.Length) {}
  65.                     File.Read(ReportDef, 0, CInt(File.Length))
  66.                     File.Close()
  67.                     RServices.CreateReport(ReportPath.Remove(ReportPath.Length - 4, 4), CurrentFolderName, True, ReportDef, Nothing)
  68.                 End If
  69.                 CurReportFolderName = "/" & ReportParentFolderName
  70.             Next
  71.  
  72.         Catch ex As Exception
  73.             Console.WriteLine(ex.Message)
  74.         End Try
  75.     End Sub
  76. End Module
Jan 18 '08 #1
3 6564
kenobewan
4,871 Recognized Expert Specialist
It sounds like the RDL is not set correctly to point to where the datasource is being deployed. You can either change the RDL or call SetItemDatasour ces (RS 2005) or SetReportDataso urces (RS 2000) to set the data source to point to the shared data source. HTH.
Jan 18 '08 #2
balaki
5 New Member
Thanks for your response.
I tried using SetItemDatasour ces, but could not succeed. It will be very helpful, if you can provide me a code sample. Thanks in advance.
Jan 18 '08 #3
kenobewan
4,871 Recognized Expert Specialist
Then show us what you tried. Thanks.
Jan 19 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
3235
by: Tim_Mac | last post by:
hi, i read the crystal reports documentation on deploying for asp.net, but they tell you to build a web setup project, which i presume is an msi. i only have FTP access to the web server and hence can't run MSI's on it. does this mean i can't use CR in my web app? is there any way around it? thanks tim
0
2348
by: Robert Warnestam | last post by:
Hello, I have some problems deploying Crystal Reports. I'm using Visual Studio 2005 Beta 1. In this version Crystal Reports (9.7.3500.0) is included. I created a small test application (ASP.NET) that shows a simple report. It work fine with on my local computer. Now I'm trying to deploy this sample application on our web server but I really need some help.
4
2369
by: Aaron Schnieder | last post by:
Hi, I have developed an ASP .NET application which using Crystal Reports for my reporting needs. My local development is Windows XP Pro with IIS and Visual Studio .NET 2003. The ASP .NET site and the reports I have written work great on my local IIS environment, the problem comes in when I try to deploy my application to my ASP .NET server. I have signed up for an ASP .NET business account with 1and1.com. The ASP ..NET works great on...
2
8201
by: Martin Widmer | last post by:
Hi guys I am looking for the best way to generate new reports with reporting services for SQL server 2005. The reports will be generated programmatically from a .Net VB application. So far I see the only way to do it is to feature my objects (text blocks, pictures, tables drawn from excel and databases etc.) with a "render to RDL"- function and thus create an RDL definition of the report, then push that one to the server using the...
5
15333
by: Brian McClellan | last post by:
Just wondering if anyone has a simple example of creating a gridview completely programmatically, i'm not doing anything terribly sophisticated. When creating the gridview declaratively evertying works fine, however programmatically, while the grid will display data that exsists in the database, any operation on the data ( editing/updating/deleting ) seems to cause a rowdeleting/updating etc error. Or is this simply not meant to be done?
0
1091
by: Pieter | last post by:
Hi, I'm having a problem deploying Reporting Services Reports on a ReportServer, when the reports have to be put in subdirectory's and use a shared DataSource. I'm using an application similar to this one: http://www.devx.com/dotnet/Article/22014/0/page/1 When I'm trying to deploy to a subdirectory of the folder in which I put the
0
3827
by: p.strong | last post by:
Gday, I am trying to deploy a windows forms application that uses crystal reports for .net 2005... Prior to publishing the application to a webserver, I have checked the prerequisite to install crystal reports .net 2005, however when I go to access the URL to install the application on a client computer I get the error:
1
2253
by: =?Utf-8?B?Y2hhaXJtYW4=?= | last post by:
I am trying to set up a Report Server to publish reports that I have created in Visual Studio 2005. I have been able to get it up and running and I am able to access reports via the web and set up another user. The other user can log on and see the reports available but when he runs then it begins to run the report then throws the error below. I have tried looking in the virus software logs to see if it is being blocked but that doesn't...
1
1415
by: Paulo | last post by:
Hi, how can I deploy the Crystal Reports dlls on server? Just copying dlls to bin folder of asp.net site? Wich dlls? VS 2005 asp.net C# 2.0 Thanks!
0
10231
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10005
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6679
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.