Click here to Skip to main content
Sign Up to vote bad
good
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)
        MsgBox(did)
 
        Dim con As SqlConnection = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True")
        con.Open()
        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)
        da.Fill(ds)
 
        Dim rptdocument As ReportDocument = New ReportDocument()
        rptdocument.Load(Server.MapPath("CrystalReport1.rpt"))
        rptdocument.SetDataSource(ds.Tables(0))
        CrystalReportViewer1.ReportSource = rptdocument
Posted 13 Oct '12 - 19:24
Edited 13 Oct '12 - 20:12


1 solution

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 373
1 OriginalGriff 335
2 Arun Vasu 315
3 Maciej Los 218
4 Aarti Meswania 180
0 Sergey Alexandrovich Kryukov 9,680
1 OriginalGriff 7,539
2 CPallini 4,018
3 Rohan Leuva 3,362
4 Maciej Los 2,951


Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 14 Oct 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid