473,772 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Crystal Report connection to SQL vb.net in Visual Studio 2008

13 New Member
My Crystal Report is pulling information from a stored procedure I wrote. So everytime I run my application it prompts me for a password for the server. How do I bypass this step and hardcode the password into my application. I don't want my users knowing the password for the server. I am writing in vb.net using visual studio 2008.
Jan 7 '09 #1
1 12707
OuTCasT
374 Contributor
You need to send the UserID and Password to the report. so it wont ask you for it when u run it.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim report As New ReportDocument
  3. Dim connection As IConnectionInfo
  4. Dim oldServerName As String = ".\SQLEXPRESS"
  5. Dim oldDatabaseName As String = "Old DatabaseName"
  6. Dim newServerName As String = strOldServerName
  7. Dim newDatabaseName As String = strCompanyName
  8. Dim UserID As String = ""
  9. Dim Password As String = ""
  10.  
  11. report.Load(Application.StartupPath + "\Reports\example.rpt")
  12. CrystalReportViewer1.ReportSource = report
  13. 'Change the server name and database in main report
  14. For Each connection In report.DataSourceConnections
  15. report.DataSourceConnections(oldServerName, oldDatabaseName).SetConnection(newServerName, newDatabaseName, UserID, Password)
  16. Next
  17. 'Change the server name and database subreports
  18. Dim subreport As ReportDocument
  19. For Each subreport In report.Subreports
  20. For Each connection In subreport.DataSourceConnections
  21. If (String.Compare(connection.ServerName, oldServerName, True) = 0 _
  22. And String.Compare(connection.DatabaseName, oldDatabaseName, True) = 0) Then
  23. subreport.DataSourceConnections(oldServerName, oldDatabaseName).SetConnection(newServerName, newDatabaseName, UserID, Password)
  24. End If
  25. Next
  26. Next
  27. CrystalReportViewer1.RefreshReport()
  28.  
Jan 15 '09 #2

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

Similar topics

1
19182
by: Stephan | last post by:
Hi, I'm using Visual Studio 2003 (C#) with the integrated Crystal Report software and have the following question: How can I assign a value (string) to an unbound (string) field in Crystal Report at runtime? Example: private void button1_Click(object sender,
6
4122
by: Dr. Indera | last post by:
hello, much to my surprise, the version of crystal that comes with visual studio.net 2003 does not have a report preview window. i found out that i have to build a form in visual basic.net and use the crystal view object to be able to view forms. the form works fine for me, so i created a .exe of the form and emailed it to a friend because i thought they would be able to use the form/.exe without having visual studio.net installed. that...
2
2382
by: GC | last post by:
HI, I'am using Crystal Report with visual Studio .NEt 2003 When i make a report using a store procedure, I can not see all the fields of the store proc and i'm suppose to see those fields. I'm suppose to see a "+" sign at the left of the store procedure name in the Field Explorer section When we click on the sign "+" we see all the field of the store proc. We can from there select and drag those fileds on the report.
0
1334
by: SWu | last post by:
Hi all Could someone please tell me how to configure and deploy my Crystal reports? Any help would be greatly appreciated. I want to be able to deploy my reports/web pages to another domain, web server, database and have the report connect via integrated security. 1. I have created a stored proc in my SQL Server db, created a report in my ASP.NET project, created a reports.aspx and placed a CrystalReportViewer on the page. This is...
11
9698
by: =?Utf-8?B?cmtibmFpcg==?= | last post by:
How can I stop receiving this message while calling a crystal report? "The report you requested requires further information." Thanks
1
2476
Shashi Sadasivan
by: Shashi Sadasivan | last post by:
Hi, I have bumped into this issue where my application (which consistently reads the database) has to also create a crsytal report when requested. The crystal repost uses the same connection string as the application (i parsed the connection string and set the ConnectionInfo) However, the crystal report fails to logon and gives an exception : Logon failed. Error in File Quote {E2D18712-BD5A-4EE7-867E-79F137EB549D}.rpt: Unable to connect:...
6
4895
by: Miro | last post by:
I can run an exe ( and its install ) i have created on my machine. The exe has a button that populates a dataset and then shoots it to a crystal report. But... Installing the setup.exe on my other pc, and running it I get an error. The Dataset loads properly, but when the button is pushed to view the report I get this error: ************** Exception Text **************
4
3314
by: Miro | last post by:
<i have also added this reply to the other newsgroup - now that I have realizd ( and assuming ) it is not a localized error directly to vb.> I have found this link on the website: https://www.sdn.sap.com/irj/sdn/businessobjects-downloads ..NET Utility CR 2008 Merge Modules for the .NET Framework ZIP 74.716 Windows English 12.03.2008 and it states:
1
8145
by: =?Utf-8?B?Q2lhcmFuIE8nJ0Rvbm5lbGw=?= | last post by:
On reflection, you could possibly make the app a self extracting zip file which extracts the EXE and a settings file and then starts the app, then when you app closes, it can repack the settings file and itself into the exe. You would probably want a tool for this bit which could be in the zip too. So the app isnt single exe when running but when not running, it is. Just an idea for you to think about. Another option would possibly be to...
0
9621
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10264
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
10106
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
10039
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
8937
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7461
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
6716
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
5355
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...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.