Click here to Skip to main content
15,885,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I got some real problem...

I was developed on Windows 8 (VS Ultimate 2013). my database is access (oledb).
my computer is show when view event of crystal report..(doen't ask database login prompt)
but, other pc will install my app. Ask Database login prompt popup ㅜㅜ

Please help me asap... please

my report form code is below...

'//////////////////////////////////////////////////

VB
Imports System.Data
Imports System.Data.OleDb
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class PickupSlipDisplay

Dim dsorder As New DataSet
Private Sub PickupSlipDisplay_Load(sender As Object, e As EventArgs) Handles MyBase.Load
printprv()
End Sub

Function getorderlist()
Dim ds As New DataSet
Dim conn As New OleDbConnection
Dim cmd As New OleDbCommand
Dim da As New OleDbDataAdapter
Dim sconnstr As String
Try
sconnstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\CNCSales.mdb;Jet OLEDBatabase Password=2076;Mode=Readwrite"
conn = New OleDbConnection(sconnstr)
cmd.Connection = conn
cmd.CommandType = CommandType.Text
cmd.CommandText = "Select [psno],[custcode],[custname],[orderindex],[itemcode],[itemname],[itemextname],[size],[qty],[price],[amount] from [pickupslip] where [psno]='" & picno & "'"
da.SelectCommand = cmd
da.Fill(ds)
Catch ex As Exception
MsgBox(ex.Message)
End Try
Return ds
End Function

Public Sub printprv()
Dim rptdoc As CrystalDecisions.CrystalReports.Engine.ReportDocument = Nothing

Try
Windows.Forms.Cursor.Current = Cursors.WaitCursor

If rptdoc Is Nothing Then
rptdoc = New CrystalDecisions.CrystalReports.Engine.ReportDocument
End If

rptdoc.Load("" & Application.StartupPath & "\PickupSlip.rpt")
dsorder = getorderlist()
rptdoc.SetDataSource(dsorder.Tables(0))

CrystalReportViewer1.ReportSource = rptdoc
CrystalReportViewer1.Refresh()

rptdoc.PrintToPrinter(1, True, 1, 0)

Catch ex As Exception
MsgBox(ex.Message)
Exit Sub
Finally

End Try
End Sub

End Class
Posted
Updated 17-Mar-15 4:06am
v2
Comments
Richard Deeming 17-Mar-15 10:20am    
Your code is vulnerable to SQL Injection[^].

NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.

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