i get error 0x800A5077, i try import CrystalActiveXReportViewerLib10 and CrystalReportsCommonObjectModelLib, but it still no work.
Call ReportConnection(CInspAuditList, "Pab_Prod")
CInspAuditList.ReportFileName = My.Application.Info.DirectoryPath & "\MAuditList.rpt"
Call SubReportConnection(CInspAuditList, "Pab_Prod")
CInspAuditList.set_ParameterFields(0, "mchno; " & frmMachine.machine & " ;true")
CInspAuditList.set_ParameterFields(1, "batch; " & CDbl(frmMachine.batch) - 1 & " ;true")
CInspAuditList.set_ParameterFields(2, "Points; " & InpStdPt & " ;true")
CInspAuditList.set_ParameterFields(3, "ovrpt; " & OvrPoints & " ;true")
CInspAuditList.Action = 1
the error occur when CInspAuditList.Action = 1
vb.net help me declare CInspAuditList as AxCrystal.AxCrystalReport
This is my function for connection:
Public Function ReportConnection(ByRef CrystalReport1 As AxCrystal.AxCrystalReport, ByRef dsnname As String) As Boolean
CrystalReport1.Connect = "dsn=" & dsnname & ";UID=" & gstrID & ";PWD=" & gstrPassword & ";DSQ="
End Function
I want to know the reason cause the error happen & my connection correct or not
That happened to me and that is because the report file (.rpt) contains a connection to a database that doesn't exists or cannot be located by the computer where you are running the program solution: open the report file (.rpt), menu database, verify database, checkout the parameters of the connection(mine is sql connection), ok, and you can see a msg that say the database is up to date, ok, save changes in report
If you ara using system dsn, crystal report needs admin rights for connect.
In the registry ODBC key is Local Machine and only grant Full Control to System and Administrators.
Related
The system was having two databases connection, one is with the MS Access database and the other was IBM's Informix database. The Crystal Reports were working fine with the MS Access Database. Now we have removed the dependency on MS Access and moved all the tables into Informix. While migrating the data, the table names were changed. The database was changed in the report from the menu Database > Add Database to report and the old database was removed using menu Database > Remove from report. The database driver has been converted to 'pdsodbc.dll [ODBC]' using the menu Database > Convert database driver...
Post that I am getting an error in vb6 code.
Error description: Creating data source failed.
Error code: 20609
My code in the vb is as follows:
CrystalReport1.WindowTitle = "Embosser/Encoder Report"
CrystalReport1.ReportFileName = App.path & "\Rpt3.rpt"
CrystalReport1.Connect = "DSN=" & DSN & ";Database=rbtt;UID=" & remlog & ";PWD=" & rempass & "; Persist Security Info=False"
CrystalReport1.Formulas(0) = "bank = ' " & Mainfrm.StatusBar1.Panels(2) & " ' "
CrystalReport1.Formulas(1) = "user = 'User Name: " & useN & " ' "
CrystalReport1.Formulas(2) = "title = 'Embosser/Encoder Report'"
stop_len = format(param3, "00")
start_len = format(param1, "00")
local_card_len = format(local_card_len, "00")
CrystalReport1.Formulas(3) = "lens = '" & local_card_len & start_len & stop_len & " ' "
CrystalReport1.SQLQuery = sql
CrystalReport1.WindowState = crptMaximized
CrystalReport1.Action = 1
I am getting the error when the line CrystalReport1.Action = 1 is executed.
The variable sql contains an sql query which has all the columns required in the report.
The variable DSN has the DSN name which is configured in the ODBC.
The variables remlog and rempass have the username and password required to connect to the server. Other details like server ip are mentioned in the DSN.
I am having problems upgrading SQLite from v1.0.115 to v1.0.116 in Visual Studio 2022 with VB.Net, Debug, Any CPU.
To test this, I made two identical test-projects. In one I installed System.Data.SQLite v1.0.115 via the NuGet Package Manager. In the other I installed v1.0.116 in the same way.
In v1.0.115 the following line is fine:
conn.LoadExtension("SQLite.Interop.dll", "sqlite3_json_init")
but in v1.0.116 I get an error for that line: The specified procedure could not be found.
I did see a post that suggested adding the full path to the Interop file, so I tried:
conn.LoadExtension(Application.StartupPath() & "\bin\Debug\x86\SQLite.Interop.dll", "sqlite3_json_init")
but this gives an error for that line: The specified module could not be found.
For reference, my full function is:
Public Function Connect(ByVal DBnum As Integer) As SQLiteConnection
Dim conn As New SQLiteConnection
Dim DBpath As String = Application.StartupPath() & "\hamdata.db3"
Try
conn = New SQLiteConnection("Data Source=" & DBpath & ";Version=3;")
If conn.State = ConnectionState.Closed Then
conn.Open()
conn.EnableExtensions(True)
conn.LoadExtension("SQLite.Interop.dll", "sqlite3_json_init")
End If
Catch ex As Exception
Debug.WriteLine(vbCrLf & "Message:" & vbCrLf & ex.Message)
Debug.WriteLine(vbCrLf & "Source:" & vbCrLf & ex.Source)
Debug.WriteLine(vbCrLf & "StackTrace:" & vbCrLf & ex.StackTrace)
Debug.WriteLine(vbCrLf & "TargetSite:" & vbCrLf & ex.TargetSite.ToString())
MsgBox("Connection to Database " & DBnum & " at '" & DBpath & "' has Failed! Message: " & ex.Message)
End Try
Return conn
End Function
The 'Path.Combine' didn't work at all, for some reason!
Debug.WriteLine(Path.Combine(Application.StartupPath, "\bin\Debug\x86\SQLite.Interop.dll"))
returned: \bin\Debug\x86\SQLite.Interop.dll
Debug.WriteLine(Application.StartupPath)
returned: C:\Programming\SQLite\SQLite_v1.0.116_TestBed\bin\Debug
Debug.WriteLine(Application.StartupPath & "\bin\Debug\x86\SQLite.Interop.dll")
returned: C:\Programming\SQLite\SQLite_v1.0.116_TestBed\bin\Debug\bin\Debug\x86\SQLite.Interop.dll
Both of the following lines:
conn.LoadExtension(Path.Combine(Application.StartupPath, "\bin\Debug\x86\SQLite.Interop.dll"), "sqlite3_json_init")
conn.LoadExtension(Application.StartupPath & "\bin\Debug\x86\SQLite.Interop.dll", "sqlite3_json_init")
returned the error: 'The specified module could not be found.'
so I feel that the path-changes are a red-herring. As mentioned before,
conn.LoadExtension("SQLite.Interop.dll", "sqlite3_json_init")
returns the error: 'The specified procedure could not be found.'
which might indicate that the file 'SQLite.Interop.dll' has been found, but the internal procedure was not.
Following a suggestion in another post, I then deleted both the 'x64' and 'x86' folders in the Debug folder, and then did a 'Build'. The folders and their 'SQLite.Interop.dll' files were replaced, but the 'The specified procedure could not be found.' error continued, so I am no further forward!
SUCCESS
It appears that the problem is to do with the extension's entry point, for which I was using "sqlite3_json_init". The documentation says you can leave this argument blank and the extension loader logic will attempt to figure out the entry point on its own, but when I tried it I just got the 'The specified procedure could not be found.' error again. After some more searching, I found someone mentioning the entry point "sqlite3_fts5_init". I tried this in the line:
conn.LoadExtension("SQLite.Interop.dll", "sqlite3_fts5_init")
and everything seems to be working again!
I am attempting to code a little Customer/sales database in VB. However on compiling I am getting the error stated in the subject. Apparently there is no connection to the database posible.
Here is the code I got so far:
Public Class Principal
Using Connect As SqlConnection =
Friend Sub CreateDatabase()
New SqlConnection("Data Source=(local);" &
"Integrated Security='SSPI';")
Dim strCreateDatabase As String = "IF EXISTS ( " &
"SELECT name " &
"FROM sys.databases " &
"WHERE name = N'BMSTIDB'" &
" ) " &
"DROP DATABASE BMSTIDB; " &
"CREATE DATABASE BMSTIDB"
Dim Command As SqlCommand =
New SqlCommand(strCreateDatabase, Connect)
Connect.Open()
Connect.ExecuteNonQuery()
MsgBox("A Database with the name of " &
"BMSTIDB has been created. ")
End Using
It compiles fine and it doens't display any errors or issues. However as mentioned above it does give the error upon running, when it first attempts to connect to the DB.
I am using Visual Studio 2015 Enterprise and Community.
Thanks a lot,
BenjB
New SqlConnection("Data Source=(local);" &
"Integrated Security='SSPI';Database=master")
You're missing a closing single quote here:
"WHERE name = N'BMSTIDB" &
It should be:
"WHERE name = N'BMSTIDB'" &
Once you fix that you'll find you're also missing the BEGIN and END keywords.
I am doing the programming on my computer and it works fine-the program, the database itself, inserting to the database is also working fine. But when I publish it and install the program on another computer. It crashes and does not execute the INSERT command.
Here is my code.
Private Sub cmdBlank_Click(sender As System.Object, e As System.EventArgs) Handles cmdBlank.Click
strTariff1 = txtPart1.Text & " " & txtPName1.Text & " " & txtQty1.Text & " " & txtU1.Text
strTariff2 = txtPart2.Text & " " & txtPName2.Text & " " & txtQty2.Text & " " & txtU2.Text
strTariff3 = txtPart3.Text & " " & txtPName3.Text & " " & txtQty3.Text & " " & txtU3.Text
strTariff4 = txtPart4.Text & " " & txtPName4.Text & " " & txtQty4.Text & " " & txtU4.Text
'strTariff5 = txtPart5.Text & " " & txtPName5.Text & " " & txtQty5.Text & " " & txtU5.Text
Call saveToDb()
frmreportax.Show()
End Sub
Private Function saveToDb()
conn.Close()
Dim cmdAdd, cmdCount, cmdAdd2 As New iDB2Command
Dim sqlAdd, sqlCount, sqlAdd2 As String
Dim curr1, curr2, curr3, curr4 As String
Dim count As Integer
conn.ConnectionString = str
conn.Open()
'Check for duplicate entry
sqlCount = "SELECT COUNT(*) AS count FROM cewe WHERE transport=#transport AND blnum=#blnum"
With cmdCount
.CommandText = sqlCount
.Connection = conn
.Parameters.AddWithValue("#transport", frmPart1.txtTransport.Text)
.Parameters.AddWithValue("#blnum", frmPart1.txtNo.Text)
End With
count = Convert.ToInt32(cmdCount.ExecuteScalar())
If count <> 0 Then
MsgBox("Duplicate Entry: " & frmPart1.txtTransport.Text, vbOKOnly + vbExclamation)
Else
sqlAdd = "INSERT INTO cewe (page) " & _
"VALUES (#page) "
With cmdAdd
.Parameters.AddWithValue("#page", Val(frmPart1.txtPage.Text))
.CommandText = sqlAdd
.Connection = conn
.ExecuteNonQuery()
End With
end if
cmdAdd.Dispose()
cmdAdd2.Dispose()
conn.Close()
end function
Please tell me what I am doing wrong? When I run and install the program on my PC, it works perfectly fine. But when I run/install it on another PC, it crashes after the cmdBlank is clicked.
There could be a number of things causing the issue but the first place to look is any error logs or crash report that may give some indication of the problem. Try debugging or logging to get a better picture. Beyond that there are some small suggestions that may help below.
Does the other computer have access to the database you are pointing to? Is the database connection pointing to localhost? In which case you will want to ensure that you have the same credentials (host, username, password, port etc.) set up on the database server on new computer. Are database drivers installed on new computer? What are the fundamental differences between the two machines?
AS400 iSeries DB2 needs to be updated to version 6.xx.0800 and did the tweak!
Installer can be found here
http://www-03.ibm.com/systems/power/software/i/access/windows_sp.html
Problem solved!
I have two version of my access frontend. One for Access 2003 which is still being run by a few computers not yet upgraded to Access2010 and Win7, the Acces2010 version unfortunately is caused in Access crash in 2003 at close of the mainform that I have been unable to fix. Backend is SqlServer 2005 SqlExpress version.
Therefore I am stuck with the older frontend for 2003 people, who fortunately don't need the newer capabilities in 2010 version.
Now, a maintenance utility which loads data from a mainframe dump is getting blocked by a "SELECT 1 on Patient_Clinic_Visits" when the Access 2003 version is running somewhere. What I can't find, is where that "SELECT 1 on Patient_Clinic_visits" is coming from.
I have looked in all the module code, and all the queries, but can't find anything like that.
I assume it must therefore be in the frontend form, but how do iI search that without looking through all the objects and controls of that form for RecordSource with some SQL code in it?
cheers,
JonHD
In the end I searched some other questions and thought about programmatically dumping the likely offending information. This is my concoction of two different answers to do what I want. Do to the limits of the Instant Window in VBA over how many lines it will keep from a Debug.Print, I have used WScript object to dump to a log file.
The code basically:
opens each form in the database in turn
dumps its RecordSource description
then for each control on its form, dumps relevant information that MAY contain SQL in some way
note: I use the fact that a Writeline (some code) that causes and error will fail and not write to avoid a lot of testing for different control types for which properties to dump or not dump.
then closed the forms
then it goes through all the queries in the database, and dumps SQL code
(Note1: in the end this didn't find the answer to my problem - see my other recent question!!)
(Note2: this was a quick and dirty script. I noticed the first time it ran the WriteStream didn't write anything, even though it on Step ing through the code it seemed to be doing something. Anyhow when I ran it again it worked. Haven't taken the time to debug why!).
Function DumpFormsAndQueries()
Dim obj As AccessObject
Dim objctrl As Control
Dim frm As Form
Dim dbs As Object
Dim fsoSysObj As FileSystemObject
Dim filFile As Object
Dim txsStream As TextStream
Dim strPath As String
Set dbs = Application.CurrentProject
Set fsoSysObj = New FileSystemObject
' Return Windows Temp folder.
strPath = "C:\Temp\"
On Error Resume Next
' See if file already exists.
Set filFile = fsoSysObj.GetFile(strPath & "Database_Form_dump.Log")
' If not, then create it.
If Err <> 0 Then
Set filFile = fsoSysObj.CreateTextFile(strPath & "Database_Form_dump.Log")
End If
Debug.Print ">> dumping to: " & strPath & "Database_form_dump.log"
Set txsStream = filFile.OpenAsTextStream(ForAppending)
For Each obj In dbs.AllForms
DoCmd.OpenForm obj.name, acDesign
Set frm = Forms(obj.name)
Debug.Print ">>>> dump form: " & obj.name
txsStream.WriteLine "====================================================================="
txsStream.WriteLine "Form : " & obj.name
txsStream.WriteLine "RecordSource: " & frm.RecordSource
txsStream.WriteLine "====================================================================="
For Each objctrl In frm.Controls
txsStream.WriteLine " --------------------------------------------------"
txsStream.WriteLine " : " & objctrl.name & " Type = " & TypeName(objctrl)
txsStream.WriteLine " --------------------------------------------------"
On Error Resume Next
txsStream.WriteLine " >>>> Recordsource: (" & objctrl.RecordSource & ")"
txsStream.WriteLine " >>>> Controlsource: (" & objctrl.ControlSource & ")"
txsStream.WriteLine " >>>> Rowsource: (" & objctrl.RowSource & ")"
txsStream.WriteLine " >>>> Caption: (" & objctrl.Caption & ")"
txsStream.WriteLine " >>>> Text: (" & objctrl.Text & ")"
txsStream.WriteBlankLines 1
Next objctrl
DoCmd.Close acForm, obj.name, acSaveNo
txsStream.WriteBlankLines 3
Next obj
txsStream.WriteLine "====================================================================="
txsStream.WriteLine " Q U E R I E S - in database"
txsStream.WriteLine "====================================================================="
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Set db = CurrentDb()
For Each qdf In db.QueryDefs
txsStream.WriteLine "Query: " & qdf.name
txsStream.WriteLine "SQL (start) ---------------------------------------------------- "
txsStream.WriteLine qdf.sql
txsStream.WriteLine "SQL (end) ---------------------------------------------------- "
Next qdf
Set qdf = Nothing
Set db = Nothing
txsStream.Close
Debug.Print ">> ended"
End Function
In Access menu select Database Tools->Database Documenter. There, select all objects and push OK. It will take some time, but then you will be presented with a report that lists everything in your database, including the code at the end.
The report could be quite big for big databases.
You can export the report to Word (there is an option for it). There, search for your string. (I think it should be "SELECT 1 from Patient_Clinic_visits")