Click here to Skip to main content
13,149,756 members (54,690 online)
Rate this:
Please Sign up or sign in to vote.
See more: , +
I have made a web application in this there is one crystal report ,for selecting data for crystal report i am passing a value from another web page using query string & and works fine using this value i want to search and print the data in crystal report but i got error that "DATABASE LOGON FAILED" i am posting for generating crystal report please give the solution thanx in advance

Dim did As Integer
        Dim d_id As String = Request.QueryString("did")
        'taking d_id value from another web page and convert it to integer
        did = Convert.ToInt32(d_id)
        Dim con As SqlConnection = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True")
        Dim cmd As SqlCommand = New SqlCommand("select * from t_donor where d_id=" & did & "", con)
        Dim ds As New DataSet()
        Dim da As SqlDataAdapter = New SqlDataAdapter(cmd)
        Dim rptdocument As ReportDocument = New ReportDocument()
        CrystalReportViewer1.ReportSource = rptdocument
Posted 13-Oct-12 19:24pm
Updated 13-Oct-12 20:12pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

ridoy 14-Oct-12 6:48am
vishal879 30-Aug-13 10:43am
This can be happen when no of column supplied in crystal report does not match with dataset(coding)..when you are working with more than one table than also create only one datatable in dataset..
Monjurul Habib 15-Oct-12 16:40pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170924.2 | Last Updated 14 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100