Click here to Skip to main content
14,732,830 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have developed one software for Iron trading company.I have to give them so many crystal reports.My back end is MS ACCESS 2003.
The problem is that in one of my crystal reports asks for admin password every time i load at his computer while other report is showing smoothly.This is happening even there is same code in every crystal report.Plz give me solution ASAP.I m frustrated from this problem...

Private Sub itemrpt_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\ispat.mdb;Persist Security Info=True;Jet OLEDB:Database Password=admin"
            Dim da As New OleDbDataAdapter("select  distinct item_name from m_item", cn)
            Dim ds As New DataSet
            Dim i As Integer = 0
            For i = 0 To ds.Tables(0).Rows.Count - 1
            'cmbID.SelectedIndex = 0

            cmbitem.Text = a

        Catch ex As Exception
            MsgBox("E-itemRpeort Load")

        End Try
    End Sub

            Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\ispat.mdb;Persist Security Info=True;Jet OLEDB:Database Password=admin")

            Dim query As String = "Select * from t_purchase Where su_name='" & cmbsup.Text & "' and truck_no='" & cmbtruck.Text & "'and pu_id in(select pu_id from m_item where item_name='" & txtitem.Text & "'and sub_item='" & txtsubitem.Text & "')"
            Dim da As New OleDbDataAdapter(query, cn)
            Dim ds As New DataSet
            da.Fill(ds, "t_purchase")

            Dim query1 As String = "Select * from t_sale"
            Dim da1 As New OleDbDataAdapter(query1, cn)
            da1.Fill(ds, "t_sale")

            Dim query2 As String = "Select * from m_item Where item_name='" & cmbitem.Text & "' and sub_item='" & cmbsubitem.Text & "'"
            Dim da2 As New OleDbDataAdapter(query2, cn)
            da2.Fill(ds, "m_item")

            doc.Load(Application.StartupPath & "\item_rpt.rpt")
            CrystalReportViewer1.ReportSource = doc
        Catch ex As Exception
        End Try

    End Sub

thnx in advance....

are you using multiple tables in that particular report??
if yes, then don't use multiple tables....just create a view for those tables...
hope this will help u..
Kschuler 28-Sep-11 11:10am
How does this have anything to do with the question of prompting credentials?
mit anadkat 22-Nov-11 9:51am
can u post code for creating data view with three tables..plz
bkthebest 23-Nov-11 0:23am
yes, sure...
suppose you have 2 tables
1. table1(p_ID,f_name,l_name)
2. table2(ID,p_ID,billdate)
now copy and paste bellow code into sql server

create view v1 as
SELECT dbo.table1.p_ID, dbo.table1.f_name + ' ' + dbo.table1.l_name AS Pname, dbo.table2.billdate
FROM dbo.table1 INNER JOIN dbo.table2 ON dbo.table1.p_ID = dbo.table2.p_ID with ckeck option

use datatypes as required but remember in both tables field name with "p_ID" must have same datatype because it used as a foreign key in table2

hope this will help you
This is actually a common issue.[^]

Here[^] is what I suggested to someone else who had a similar problem.
@ Kschuler:I have tried that also by creating data d same problem is continue with my client.Plz frns if u ve any suggestions with coding then put improved that i can come up from this frustration.
just add the code-

report.SetDatabaseLogon(user, pwd)

u need to declare the "report" and the user, pwd before this line of code..
problem is with your data set

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900