473,405 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Logon Failed,Description:Invalid authorization specification error in crystal report

15
Hi,

I am new to .NET.I have created a desktop application in C#.NET that has Crystal reports used in it. This all works fine when I log in on the "EVERY" as servername which is the default name of my machine and also SQL SERVER name. However when I run it on another machine it does not work.It expect "EVERY" server.It should expect because the name of the sql server is that.
If I specify the servername as local while generating report then it is unable to identify the database name and generate the following error:

Logon Failed
Description:Invalid authorization specification

while If I use "EVERY" as server name then it works fine on my system but unable to run on another machine...
I want to know that how to remove such error so that my reports works well on every machine.Please specify me the whole procedure...I have already searched alot but unable to grasp the solution of the problem..

I am expecting answer as soon as possible...
Thanks and regards,
bye
May 21 '09 #1
1 5243
OuTCasT
374 256MB
You need to change the server and login information of the crystal reports in code.
what i do is retrieve the current servername from each pc
Expand|Select|Wrap|Line Numbers
  1. Dim sqlcon As SqlConnection = New SqlConnection("Server=(local);Data Source=.\sqlexpress;Initial Catalog='" & strCompanyName & "';Integrated Security=True")
  2.         Dim sqlCOm As SqlCommand = New SqlCommand("select @@servername", sqlcon)
  3.         sqlcon.Open()
  4.         strOldServerName = sqlCOm.ExecuteScalar
  5.         sqlcon.Close()
I then use that name as the new servername.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Report()
  2.         Dim report As New ReportDocument
  3.         Dim connection As IConnectionInfo
  4.         Dim oldServerName As String = "OLD SERVERNAME"
  5.         Dim oldDatabaseName As String = "OLD DATABASENAME"
  6.         Dim newServerName As String = strOldServerName
  7.         Dim newDatabaseName As String = NEWDATABASENAME
  8.         Dim UserID As String = ""
  9.         Dim Password As String = ""
  10.  
  11.         report.Load(Application.StartupPath + "\Reports\ForcedPay.rpt")
  12.         CrystalReportViewer1.ReportSource = report
  13.  
  14.         'Change the server name and database in main report
  15.         For Each connection In report.DataSourceConnections
  16.             report.DataSourceConnections(oldServerName, oldDatabaseName).SetConnection(newServerName, newDatabaseName, UserID, Password)
  17.         Next
  18.         'Change the server name and database subreports
  19.         Dim subreport As ReportDocument
  20.         For Each subreport In report.Subreports
  21.             For Each connection In subreport.DataSourceConnections
  22.                 If (String.Compare(connection.ServerName, oldServerName, True) = 0 _
  23.                    And String.Compare(connection.DatabaseName, oldDatabaseName, True) = 0) Then
  24.                     subreport.DataSourceConnections(oldServerName, oldDatabaseName).SetConnection(newServerName, newDatabaseName, UserID, Password)
  25.                 End If
  26.             Next
  27.         Next
  28.         CrystalReportViewer1.RefreshReport()
  29.     End Sub
May 26 '09 #2

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

Similar topics

2
by: Mark Miller | last post by:
I'm not sure why this is happening. I'm trying to run a late-bound report. My original code looked like this: TableLogOnInfo logOnInfo = new TableLogOnInfo ();...
0
by: Bon | last post by:
Hello All I got "Tables are skipped or export failed" error when I used upsizing wizard on migrating MS Access 2000 to MS SQL Server 2000. I am changing my application backend database from MS...
0
by: QZ | last post by:
This one happens once in while and I would appreciates any help that I can get. We have a webservice that generate pdf invoice files. We use dataset as our Source. i.e. we use SetDataSource(data);...
2
by: suicidaltendencies | last post by:
I'm getting a logon error when creating my crystal reports. Does anyone know how to solve this Thanks Harold
9
by: Bijoy Naick | last post by:
I've implemented forms authentication and authorization on my application. In my Web.Config, my authorization section looks like this.. <authorization> <allow roles="admin" /> <deny users="*"...
0
by: Greg | last post by:
Hi, creating template1 database in /var/pgsql/data1/base/1... DEBUG: invoking IpcMemoryCreate(size=1081344) FATAL: shmat(id=1179648) failed: Invalid argument What's the problem why is shmat...
3
by: ralphdepping | last post by:
Trying to get moinmoin wiki working on Windows 2000 using IIS and python. I get the following error when trying to view the start page after insalling moinmoin and python - key error seems to be...
0
by: kalpanasuresh | last post by:
Hi, I am getting Logon error while using Crstal Reports in ASP.net.pls help Thanks in advance
5
by: kchang | last post by:
I am trying to view my reports based on a linked table database. However both the reports and the queries they're based on give me a "odbc--call failed" error. When I click on help it cites error...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
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...
0
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,...

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.