Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 535
  • Last Modified:

Database logon failed

good day.

i am receiving a "database logon failed" error in the code below.  the code works on my development machine; however, it fails on the clients and i cannot figure out why.  the client machines run other crystal reports with similiar code below.

any help would be appreciated.

thanks.
try
            {
                if (_header.ID > 0)
                {
                    ReportDocument rep = new ReportDocument();
                    rep.Load(System.Windows.Forms.Application.StartupPath + reportName);
 
                    TableLogOnInfo tliCurrent;
                    foreach (Table curr in rep.Database.Tables)
                    {
                        tliCurrent = curr.LogOnInfo;
                        tliCurrent.ConnectionInfo.ServerName = severName;
                        tliCurrent.ConnectionInfo.UserID = uID;
                        tliCurrent.ConnectionInfo.Password = uPWD;
                        tliCurrent.ConnectionInfo.DatabaseName = dbName;
                        curr.ApplyLogOnInfo(tliCurrent);
                    }
                    ParameterValues pvCollection = new ParameterValues();
                    ParameterDiscreteValue rmaCounter = new ParameterDiscreteValue();
                    rmaCounter.Value = _header.ID;
                    pvCollection.Add(rmaCounter);
 
                    rep.DataDefinition.ParameterFields[0].ApplyCurrentValues(pvCollection);
                    rep.PrintOptions.PrinterDuplex = PrinterDuplex.Default;
                    rep.PrintOptions.PrinterName = Properties.Settings.Default.PrinterName.ToString();
                    rep.PrintToPrinter(1, true, 1, 999);
                    rep = null;
                }
                else MessageBox.Show("Sorry, there is no current RMA record loaded.", "Data Required", MessageBoxButtons.OK);
            }
            catch (Exception ex)
            {
                LogWriter.LogWriter.WriteError("Error in printing RMA packing slip: " + ex.Message);
            }

Open in new window

0
freezingHot
Asked:
freezingHot
  • 4
  • 3
1 Solution
 
freezingHotAuthor Commented:
i also tried to replace the foreach loop with a SetDatabaseLogon() command; however, that didn't fix the problem either.
0
 
mlmccCommented:
I assume the user has permissions and you are passing the correct password.

The code looks correct.

Does the report have a subreport?

mlmcc
0
 
freezingHotAuthor Commented:
yes, in fact, i even added the sa username/password just to make sure.

no, the report does not have a subreport.

thanks.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
mlmccCommented:
Are you using the CR XI R2 runtimes with the application?

mlmcc
0
 
freezingHotAuthor Commented:
i believe so - i downloaded and installed the merge modules from SP2.  in addition, other reports are working fine.  there is only one (1) report that is failing with this error code.
0
 
mlmccCommented:
Since this is the only one then the applicatiion is probably ok.

What is different about this report?

mlmcc
0
 
freezingHotAuthor Commented:
finally found it...

the database provider was set as SQL Server Native Client - the client machines may not have had the drivers.  Changed it to OLEDB for SQL Server and it worked... thanks for steering me in the right direction.

have a good one.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now