Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5977995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:27:03+00:00 2026-05-22T21:27:03+00:00

I tried it with and without the database authentication code below. With the authentication

  • 0

I tried it with and without the database authentication code below.

With the authentication it fails to log in…we normally use ODBC, but I don’t see how to link it to an ODBC connection.

Without the authentication, it prints me an empty report (the real report, just as if no records were returned).

Also, how do I say print whole report if I don’t know how many pages it is, since it requires a from and to page parameter in the print function.

Reports were created in Crystal Reports XI v11.5

Thanks in advance for any help.

Here’s what I have so far:

printReport()
{
        ReportDocument cryRpt = new ReportDocument();
        cryRpt.RefreshReport += reportLoaded;
        cryRpt.Load(myReport);

        TableLogOnInfo crTableLogonInfo = new TableLogOnInfo();
        ConnectionInfo crConnectionInfo = new ConnectionInfo();
        Tables crTables;

        crConnectionInfo.ServerName = "myServer";
        crConnectionInfo.DatabaseName = "myDatabase";
        crConnectionInfo.UserID = "myUser";
        crConnectionInfo.Password = "myPass";

        crTables = cryRpt.Database.Tables;

        foreach (Table table in crTables)
        {
            crTableLogonInfo = table.LogOnInfo;
            crTableLogonInfo.ConnectionInfo = crConnectionInfo;
            table.ApplyLogOnInfo(crTableLogonInfo);
        }

        cryRpt.SetParameterValue("@report_type", type);

        cryRpt.Refresh();
}

reportLoaded(object sender, EventArgs e)
{
    PrintDialog print = new PrintDialog();
    DialogResult dr = print.ShowDialog();

    if (dr == DialogResult.OK)
    {
        ReportDocument cryRpt = (ReportDocument)sender;
        cryRpt.PrintOptions.PrinterName = print.PrinterSettings.PrinterName;
        cryRpt.PrintToPrinter(print.PrinterSettings.Copies, print.PrinterSettings.Collate, print.PrinterSettings.FromPage, print.PrinterSettings.ToPage);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:27:03+00:00Added an answer on May 22, 2026 at 9:27 pm

    For the connection to ODBC you should be able to use the ServerName property of your ConnectionInfo object to specify your connectionstring/dsn. Please see the following questions answers for a few examples.

    How do I change a Crystal Report's ODBC database connection at runtime?

    For the second part of you question, you should be able to use 0 for both page number parameters of the PrintToPrinter method to print all pages.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried without any result. My code looks like this: #include stdafx.h #include <iostream>
I tried this aproach without any success the code I'm using: // File name
(I've tried posting this on YUI message group but without any luck) Can anyone
I need to upload images using FileUpload without postback(using Ajax).I tried many examples.But in
Below is the command I tried executing, without success: exec('ln -s ' . PLUGIN_DIR
I've tried to find a way to do this, but without success. I'm looking
how to make a UIButton when moving (animated) without shadow? i tried the code
I've tried this both with and without the 'ExceptionType' parameter. I have an Error.aspx
I have tried: ObjDTOleDBNFeIntegra.Rows(I)([Cnpj Cpf]).ToString() //with brackets ObjDTOleDBNFeIntegra.Rows(I)('Cnpj Cpf').ToString() //with apostrophe ObjDTOleDBNFeIntegra.Rows(I)(Cnpj Cpf).ToString() //without
Is it possible to print full list without using cycle? I tried: Console.WriteLine([1;2;3;4;5]) and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.