Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 23rd, 2006, 03:02 AM
Registered User
 
Join Date: Apr 2006
Location: new delhi, new delhi, India.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to deepakbachelor
Default Using Crystal Report with SQL SERVER

Hi All I am writing Code for using Crystal Report with App.config.This should be used for Windows Application only.


Imports CrystalDecisions.crystalreports.engine
Imports CrystalDecisions.reportsource
Imports CrystalDecisions.shared
Imports CrystalDecisions.windows.forms

Public Class Form2
    Inherits System.Windows.Forms.Form

  Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim crtableLogoninfo As New TableLogOnInfo
        Dim crConnectionInfo As New ConnectionInfo
        Dim CrTables As Tables
        Dim CrTable As Table
        Dim TableCounter
        Dim crReportDocument1 As New RptBill
        Dim crReportDocument As New ReportDocument
        Dim crParameterDiscreteValue As ParameterDiscreteValue
        Dim crParameterFieldDefinitions As ParameterFieldDefinitions
        Dim crParameterFieldLocation As ParameterFieldDefinition
        Dim crParameterValues As ParameterValues
        Dim billno As New InfoGeneration
        Dim sname As Configuration.ConfigurationSettings
        crReportDocument.Load("../RptBill.rpt")
        With crConnectionInfo
            .ServerName = sname.AppSettings("servername")
            .DatabaseName = sname.AppSettings("dbname")
            .UserID = sname.AppSettings("username")
            .Password = sname.AppSettings("password")
        End With
        CrTables = crReportDocument.Database.Tables
        For Each CrTable In CrTables
            crtableLogoninfo = CrTable.LogOnInfo
            crtableLogoninfo.ConnectionInfo = crConnectionInfo
            CrTable.ApplyLogOnInfo(crtableLogoninfo)
        Next
        CrystalReportViewer1.ReportSource = crReportDocument
        crParameterFieldDefinitions = crReportDocument.DataDefinition.ParameterFields
        crParameterFieldLocation = crParameterFieldDefinitions.Item("@billno")
        crParameterValues = crParameterFieldLocation.CurrentValues
        crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
        crParameterDiscreteValue.Value = billno.intBillNo
        crParameterValues.Add(crParameterDiscreteValue)
        crParameterFieldLocation.ApplyCurrentValues(crPara meterValues)
        CrystalReportViewer1.Show()
    End Sub
End Class

ADD a APP.Config by Right click on Solution Explorer for creating dyanamic connection
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="servername" value="SERVERNAME"></add>
<add key="dbname" value="DATABASENAME"></add>
<add key="username" value="USERNAME "></add>
<add key="password" value="PASSWORD "></add>
</appSettings>
</configuration>


Deepak Kumar Sharma
PGMS Inc(Noida)(India)
Mobile:09313107703
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal Report & VB6 & SQL Server wlho VB How-To 2 June 5th, 2013 01:58 AM
how to call sql server function in crystal report arumugavel Access VBA 0 November 16th, 2006 12:05 AM
Connect Seagate Crystal Report with SQL Server 200 abypvarghese SQL Server 2005 6 June 23rd, 2006 03:10 AM
benifit of crystal report with asp and sql server ak SQL Server ASP 9 November 24th, 2005 09:14 PM
SQL Server 2000, ASP and Crystal Report quinn SQL Server ASP 0 March 9th, 2004 02:55 PM



All times are GMT -4. The time now is 04:40 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.