Click here to Skip to main content
11,712,727 members (79,438 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB CrystalReports
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
        Try
            cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\ispat.mdb;Persist Security Info=True;Jet OLEDB:Database Password=admin"
            cn.Open()
            Dim da As New OleDbDataAdapter("select  distinct item_name from m_item", cn)
            Dim ds As New DataSet
            da.Fill(ds)
            Dim i As Integer = 0
            For i = 0 To ds.Tables(0).Rows.Count - 1
                cmbitem.Items.Add(ds.Tables(0).Rows(i).Item(0).ToString)
            Next
            'cmbID.SelectedIndex = 0

            cmbitem.Text = a
 
            cn.Close()
        Catch ex As Exception
            MsgBox("E-itemRpeort Load")
        Finally
 
        End Try
    End Sub

Try
            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")
            cn.Open()
 

            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")
            doc.SetDataSource(ds)
            CrystalReportViewer1.ReportSource = doc
            doc.Refresh()
            cn.Close()
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
 
    End Sub
thnx in advance....
Posted 28-Sep-11 0:22am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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..
  Permalink  
Comments
Kschuler at 28-Sep-11 11:10am
   
How does this have anything to do with the question of prompting credentials?
mit anadkat at 22-Nov-11 9:51am
   
can u post code for creating data view with three tables..plz
bkthebest at 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
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

This is actually a common issue.[^]

Here[^] is what I suggested to someone else who had a similar problem.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

@ Kschuler:I have tried that also by creating data view...bt d same problem is continue with my client.Plz frns if u ve any suggestions with coding then put improved code.so that i can come up from this frustration.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

hi,
just add the code-

report.SetDatabaseLogon(user, pwd)
u need to declare the "report" and the user, pwd before this line of code..
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

problem is with your data set
  Permalink  

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

  Print Answers RSS
0 CHill60 335
1 Sergey Alexandrovich Kryukov 290
2 OriginalGriff 230
3 Andy Lanng 160
4 Maciej Los 130
0 CHill60 335
1 Sergey Alexandrovich Kryukov 280
2 OriginalGriff 230
3 Andy Lanng 160
4 Maciej Los 130


Advertise | Privacy | Mobile
Web01 | 2.8.150819.1 | Last Updated 14 Oct 2011
Copyright © CodeProject, 1999-2015
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