Hello,
I try to create report using Crystal report viewer 9 ,MS SQL and VB6. I designed the report using OLE DB(ADO) connection. I connect one table. My code is,
Option Explicit
Dim Appl As New CRAXDRT.Application
Dim Report As New CRAXDRT.Report
Private Sub Print_Click()
Set Appl = New CRAXDRT.Application
Set Report = Appl.OpenReport(App.Path & "\Bill1.rpt")
Set rs = New ADODB.Recordset
strReso = "SELECT BI_BILLNO,IM_Description,IM_SPrice,BI_QUANTITY,BI_AMOUNT " + _
"From BILLITEM,ITEMMASTER Where BI_BILLNO = " + Trim(txtBillNo.Text) + _
" and BI_ITEMCODE = IM_ItemCode"
rs.Open strReso, conMain, adOpenStatic, adLockReadOnly
Report.DiscardSavedData
Report.ParameterFields.GetItemByName("BillNo").AddCurrentValue txtBillNo.Text
Report.Database.SetDataSource rs
CRViewer91.ReportSource = Report
CRViewer91.ViewReport
End Sub
Connection String is "str1 = "Provider=SQLOLEDB.1;User ID = hemantha; Password=19760207;Initial Catalog=Waruni_Sale_System;Data Source=""
It is working. But, when I used two tables, occur a error message as
"Logon Failed,Deiails: Ado Error code 0x80040e4d, Sorce: Microsoft OLEDB Provider for SQL Server, Description: Login failed for user 'User Name', SQL State: 42000, Native Error:18456".
The report is working in Crystal Report( "Preview").
What is the wrong? Anyone can help?
What I have tried:
I try to print a bill using Crystal report viewer 9, VB6, MS SQL 2000.