Sage Line 50 ADODB connection with Classic ASP on IIS6 - Authentication Failed - vbscript

We have a classic asp page running on IIS6, which connects to our Sage Line 50 (v17) with the following code:
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
Err.Clear
On Error Resume Next
adoCon.ConnectionTimeout = 0
ConStr="dsn=SageLine50v17;UID=uid;Password=pwd;"
adoCon.Open ConStr
If Err.Number <> 0 Then
Response.Write (Err.Description& "<br><br>")
Response.Write (Err.Number)
Response.End
End If
This works perfectly most of the time. However, occasionally, it throws the following error:
Authentication failed
-2147217843
My question is, what is causing the error? I'm thinking it is Sage throwing it back, but on searching for the error number (-2147217843!), I find nothing online.

I would test the DSN in excel or access then I would check the iis usr has permissions on the sage accdata folder :)

Related

MSXML2.XMLHTTP , Method 'open' of object 'IServerXMLHTTPRequest2' failed

Dim objHTTPRequest As MSXML2.XMLHTTP
Set objHTTPRequest = New MSXML2.XMLHTTP
With objHTTPRequest
.Open MethodName, strRequest, Asynchronous, strUserName, mstrPassword
'___________more code here___________
End with
I am trying to create a serverConnection object by getting the input parameters from the user using a visual basic form. When run the code, I am getting the following error when executing the above code part. I am working on a word add-in and this error is only occurring when I run the code through vb and the created .dll for the product is working properly with Word.
The following error occurred while submitting this request to a server: Method 'open' of object 'IServerXMLHTTPRequest2' failed
The server address() may be incorrect
in here,
strRequest= "/api/a1/Properties"
If anybody could, Please tell me why is this happening. Because of that error, I am unable to debug the code for further modifications.

VB6 program fails opening Excel 2007 with Automation Error Library not registered

I created this VB6 program on my Windows 7 32bit machine with Office 2010 32bit, which runs fine. Tested it on a Windows 8 64 bit machine with Office 2013 32bit, it works. On one machine with, Windows 7 64 bit and Office 2007(32 bit only) it throws an error during the following piece of code.
The actual error message:
Run-time Error –2147319779 (8002801d) Automation error, Library not
registered
VB6 Code:
If (excel_app Is Nothing) Then
Set excel_app = CreateObject("Excel.Application")
Else
Set excel_app = GetObject(, "Excel.Application")
End If
excel_app.Visible = True
excel_version = excel_app.Application.Version
Set wBook = excel_app.Workbooks.Open(directory_path & "\templates\book1.xlsm")
So it is throwing the error when I open book1. It actual does open it and it has a macro run on Workbook_Open(), this runs right through seemly fine. After it finishes and processing of the program returns to the VB6 program it throws the error.
Here are the project references:
Has anyone come across this and what would be the fix?
[EDIT]
I am obviously doing something wrong here my error handler is throwing an error.
I did try one other thing and that was removed "Set wBook = " and it didn't throw an error. I have placed "Set wBook = " back since then, as I do need it further on in my code.
Dim wBook As Workbook
Dim excel_app As Object
On Error GoTo trialhandler
If (excel_app Is Nothing) Then
Set excel_app = CreateObject("Excel.Application")
Else
Set excel_app = GetObject(, "Excel.Application")
End If
excel_app.Visible = True
excel_version = excel_app.Application.Version
Set wBook = excel_app.Workbooks.Open(directory_path & "\templates\book1.xlsm")
MsgBox ("Exiting")
Exit Sub
trialhandler:
Dim source_string As String
source_string = excel_app.Source 'Error here
MsgBox ("My Error 1:" & source_string)
excel_app.Err
MsgBox ("My Error 2:" & excel_app.Err.Number & " " & excel_app.Err.Description)
Exit Sub
I had Office 2013 installed on this previously, then uninstalled it and placed 2007 on it, could this have any impact? Or the fact that I have created this program with reference to Excel 2010 and now I'm trying to run it against Office 2007? Though it works on the other machine with 2013. Grasping at straws here.
[EDIT 2]
It has passed the initial error to throw exactly the same error later on. This piece imports an mdb table. There must be some early binding left over
With wBook.Worksheets("Seal Register").ListObjects.Add(SourceType:=0, Source:=Array( _
"OLEDB;Provider=Microsoft.ACE.OLEDB.12.0;Password="""";User ID=Admin;Data Source=" & db_full_path & ";" _
, _
"Mode=ReadWrite;Extended Properties="""";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";" _
, _
"Jet OLEDB:Database Password="""";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;" _
, _
"Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="""";Jet OLEDB:Create System Database=False;" _
, _
"Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;" _
, _
"Jet OLEDB:SFP=False;Jet OLEDB:Support Complex Data=False"), _
Destination:=Range("A" & row_number)).QueryTable
.MaintainConnection = False
.CommandType = xlCmdTable
.CommandText = Array(db_table_name)
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = 1
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.SourceDataFile = db_full_path
.ListObject.DisplayName = "Table_" & db_table_name
.Refresh BackgroundQuery:=False
End With
There no reason to think this is a vb error.
Returns or sets the name of the object or application that originally generated the error.
object.Source [= stringexpression]
Arguments
object
Always the Err object.
stringexpression
A string expression representing the application that generated the error.
Remarks
The Source property specifies a string expression that is usually the class name or programmatic ID of the object that caused the error. Use Source to provide your users with information when your code is unable to handle an error generated in an accessed object. For example, if you access Microsoft Excel and it generates a Division by zero error, Microsoft Excel sets Err.Number to its error code for that error and sets Source to Excel.Application. Note that if the error is generated in another object called by Microsoft Excel, Excel intercepts the error and sets Err.Number to its own code for Division by zero. However, it leaves the other Err object (including Source) as set by the object that generated the error.
Source always contains the name of the object that originally generated the error — your code can try to handle the error according to the error documentation of the object you accessed. If your error handler fails, you can use the Err object information to describe the error to your user, using Source and the other Err to inform the user which object originally caused the error, its description of the error, and so forth.
From Automating Microsoft Office 97 and Microsoft Office 2000
Lori Turner
Microsoft Corporation
March 2000
PROBLEM:
My Automation client worked fine with the Office 97 version of my application. However, I rebuilt my project and it works fine with Office 2000 but now fails with Office 97. What could be wrong?
New versions of Office include new features and enhance some of the existing ones. To provide clients with programmatic access to these new and enhanced features, the object models must be updated. Because of this update, a method may have more arguments for Office 2000 than it did with Office 97.
The new arguments to existing methods are usually optional. If you use late binding to the Office Automation server, your code should work successfully with either Office 97 or Office 2000. However, if you use early binding, the differences between the 97 and 2000 type libraries could cause you problems in the following situations:
If you create an Automation client in Visual Basic and reference the Office 2000 type library, your code might fail when using an Office 97 server if you call a method or property that has changed.
If you create an MFC Automation client and use the ClassWizard to wrap classes from the Office 2000 type library, your code might fail when using an Office 97 server if you call a method or property that has changed.
To avoid this problem, you should develop your Automation client against the lowest version of the Office server you intend to support. For the best results in maintaining compatibility with multiple versions of Office, you should use late binding. However, if you choose to use early binding, bind to the type library for the earliest version of the Office server you want to support. To illustrate, if you are writing an Automation client with Visual Basic and want that client to work with Excel 97 and Excel 2000, you should reference the Excel 97 type library in your Visual Basic project. Likewise, if you are writing an Automation client using MFC, you should use the ClassWizard to wrap the Excel 97 type library.
For more information, please see the following article in the Microsoft Knowledge Base:
Q224925 INFO: Type Libraries for Office 2000 Have Changed

VB6: Automation error The remote procedure call failed

In my VB6 application sometimes in some customer PC we get error like
Automation error
The remote procedure call failed.
The error comes for the code shown below
Dim WithEvents Web_popup As SHDocVw.InternetExplorer
Set Web_popup = Nothing
Set Web_popup = New SHDocVw.InternetExplorer
Set ppDisp = Web_popup.Application
Also for the below code
Dim iE As New SHDocVw.InternetExplorer iE.Navigate "www.example.com", 4 + 8
iE.Visible = True
What may be the reason for these errors? How to solve it?
You should include more information when asking for help. More importantly, you should point exactly which lines are causing the error. That being said, it sounds to me that you are not checking the ready state of the download of html to Explorer. Interacting with a web page before the web page has been completely download will cause this symptom.
If you are checking the ready state, the only other way I was able to produce the error was turning on protected mode in Internet Explorer. Some websites cause the error when Protected mode is on.

vbscript FileSystemObject works locally but not live

can anyone tell me what's going on with this (what should be) simple peice of VBscript. It is working locally but as soon as I try it online, it kick out an error as below! Everythings saved in the root!
Any ideas appreciated! I'm starting to pull my hair out!
<%
'path = filesys.GetAbsolutePathName("c:/inetpub/wwwroot/website/somefile.txt")
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.OpenTextFile (server.MapPath("/somefile.txt"), 8, True)
filetxt.WriteLine("Last Update: ") & Now
filetxt.Close
%>
I keep getting the following error...
Microsoft VBScript runtime error '800a0046'
Permission denied
/locations.asp, line 6
Error description is clear. You need write access to the directory which you want. If you're a hosting customer, you should grant write permission to the IUSR account in your control panel. Usually, username similar to IUSR_sitename.com. So If it all gets too confusing, perhaps you should open a ticket in your provider's helpdesk.

ORA-01019 connecting to Oracle from Excel

I have installed Oracle 10g Express Edition. When try to test the connection I am getting the error "Error while trying to retrieve text for error ORA-01019".
Below is my code.
strConnection = "Driver={Microsoft ODBC for
Oracle};Server=Servername;Uid=username;Pwd=password;"
Set conn = CreateObject("ADODB.Connection")
conn.Open strConnection
conn.Close
Set conn = Nothing
Thanks in advance
I had the following error occur recently.
System.Runtime.InteropServices.COMException (0x80004005): ORA-01019: unable to allocate memory in the user side
at ADODB.ConnectionClass.Open(String ConnectionString, String UserID, String Password, Int32 Options)
I managed to resolve the problem by simply modifying my connection string.
from:
"Provider=MSDAORA.1;Data Source=tprss;Persist Security Info=True;User ID=myUser;Password=myPassword"
To:
"Provider=MSDASQL;Data Source=tprss;Persist Security Info=True;User ID=myUser;Password=myPassword"
someone modified/updated the components on the box.
"ORA-01019 unable to allocate memory in the user side
Cause: The user side memory allocator returned an error.
Action: Increase the size of the process heap or switch to the old set of calls."
Followup from the comments:
Could you try this code?
Dim Cn As ADODB.Connection
Dim CP As ADODB.Command
Dim Rs As ADODB.Recordset
Dim Conn As String
Dim QSQL As String
'Connect to Oracele server begin
Conn = "DRIVER={ORACLE ODBC DRIVER};SERVER=Service name;UID=username;PWD=password;DBQ=Service name;DBA=W;APA=T;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;FRL=F;MTS=F;CSR=F;PFC=10;TLO=O;"
Set Cn = New ADODB.Connection
With Cn
.ConnectionString = Conn
.CursorLocation = adUseClient
.Open
End With
If Cn.State = adStateOpen Then
MsgBox "Connection successful."
End If
'Connect to Oracle server end
'close connection begin
Cn.Close
Set Cn = Nothing
Set CP = Nothing
'close connection end
(This didnt fit in a Comment box)
You need at least one driver. The oracle driver is best but Microsoft Driver will work too.
Lets first try to make a connection string. Right click on your desktop and the create a new .txt file.
Now rename your textfile to something.udl
Double click on the udl file. Go to "Provider" and select Microsoft OLEDB Provider for Oracle. Then click on next. In the server name field you fill in your TNS name. Then username and password and put a V inside "Allow saving password" (we will need this) And click on test connection. Make sure this works.
If it works then click on OK. Now open the UDL file with a text editor. You will see something similar to:
[oledb]
; Everything after this line is an OLE DB initstring
Provider=MSDAORA.1;Password=yourpw;User ID=youruser;Data Source=yourTNS;Persist Security Info=True
Copy this part into your connection string:
Provider=MSDAORA.1;Password=yourpw;User ID=youruser;Data Source=yourTNS
Now your connection string should look like:
Conn = "Provider=MSDAORA.1;Password=yourpw;User ID=youruser;Data Source=yourTNS"
I hope this works.
We had the same problem, specifically on Windows 7 when using the Microsoft OleDb driver from VB6.
Following the instructions in this post fixed out problem:
http://prasanth4microsoft.blogspot.com/2010/11/windows7-excel-vba-ora-01019-unable-to.html
I had this problem also but it is on win10.. After I have tried a lots of different solution from web .. Finally.. it worked to change connection string to fix this problem.. But I changed "Provider=MSDAORA.1" to "Provider=OraOLEDB.Oracle"

Resources