|
Thanks.
I have modify it.
But the problem the same.
Run-Time error '-2147467259 (80004005':
[Microsoft][ODBC Driver manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed.
And warning
Microsoft ODBC for Oracle.
The Oracle (tm) client and networking componets were not found.
These components are supplied by Oracle......
|
|
|
|
|
Plug the warning into google and you will find there are some components you need to source from oracle, just like the warning says.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Good day! I have been trying to build an application in MapWinGIS and Visual Basic. I already added Map Control in the Toolbox and made a form. There are no codes yet but I encountered a problem. It says:
InvalidOperationException was unhandled
An error occurred creating the form. See Exception.InnerException for details. The error is: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
I have VB 2008 Express Edition, MapWinGIS v4.9.4.2 32-bit and Windows 8.1.
Thank you!
Andrea
|
|
|
|
|
SO I'm trying to connect to a SAP Business One Service Layer - according to their documentation:
> Before you perform any operation in Service Layer, you first need to log into Service Layer.
> Send this HTTP request for login:
> POST https://<server name="" ip="">:<port>/b1s/v1/Login
{"CompanyDB": "US506", "UserName": "manager", "Password": "1234"}
So, using the code from MS docs[^]
Dim request As WebRequest = WebRequest.Create("https://xxxxxxxx:port/b1s/v1/Login")
request.Method = "POST"
Dim postData As String = "{""CompanyDB"": ""XXXX"", ""UserName"": ""XXXX"", ""Password"": ""XXXX""}"
' have alternbatively tried the below - no difference in the result though
' Dim postData As String = New JavaScriptSerializer().Serialize("{""CompanyDB"": ""XXXX"", ""UserName"": ""XXXX"", ""Password"": ""XXXX""}")
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
request.ContentType = "application/json; charset=utf-8"
request.ContentLength = byteArray.Length
Dim dataStream As Stream = request.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim response As WebResponse = request.GetResponse()
Console.WriteLine(CType(response, HttpWebResponse).StatusDescription)
dataStream = response.GetResponseStream()
Dim reader As New StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd()
Console.WriteLine(responseFromServer)
reader.Close()
dataStream.Close()
response.Close()
And all I get back is "The remote server returned an error: (400) Bad Request.". Why??
I know a connection is possible, because I can connect using the Chrome extension Postman, using the same JSON data.
....
[edit] bugger something's come up and I have to pop out for a couple of hours. Apologies in advance if someone does answer and I'm not here....
modified 18-Aug-17 11:49am.
|
|
|
|
|
The first problem I see is that you're using a Javascript serializer to serialize the exact string you're supposed to be sending in the request. Don't serialize that string. Just send the string!
|
|
|
|
|
Hi
thanks - but that line was REM'd out, and was just an alternative I'd tried I desperation... - the actual line used is simply
Dim postData As String = "{""CompanyDB"": ""XXXX"", ""UserName"": ""XXXX"", ""Password"": ""XXXX""}"
and that is was is POSTed
...
|
|
|
|
|
Are there any odd characters in those values? You might want to use the JSON serializer and serialize an object just to be sure:
Dim postData As String = New JavaScriptSerializer().Serialize(New With { .CompanyDB = "XXXX", .UserName = "XXXX", .Password = "XXXX" })
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
No - no odd characters - but tried your suggestion anyway - to no avail 
|
|
|
|
|
I'd approach the problem like this. Go get Fiddler[^], install, run, and start a capture.
Start Chrome and go through the extension you used before to successfully connect. Then, start your code and attempt the same connection.
Stop the capture in Fiddler and start looking through the capture to see exactly what was sen to to SAP to get a good response and compare that to what your code is sending. There's probable something missing in the headers or something like that you you're cod is going to have to add.
|
|
|
|
|
Yeah... ta... I guess I should try it again (looked at it once before) and tbh the logs are all a bit greek to me at that level... 
|
|
|
|
|
I have a vb.net 2010 desktop application that I need to make a change to.
When the application runs, it runs in some predetermined size. The users are not able to drag the width or length arrows to increase the size of when the application runs on their desktops. They would like to increase the size of the application since they cannot see some of the wording.
Thus can you tell me what I can do:
1. Increase the default size of the application when it runs on a users desktop? and/or
2. Allow the user to adjust the size of the application when it is actually executing? Increasing the width and/or length of the application?
|
|
|
|
|
dcof wrote: 2. Allow the user to adjust the size of the application when it is actually executing? Increasing the width and/or length of the application? This would be the social way. If you go for the first option, then some people will complain that the default size is too big.
People also have the option to set a different font as default in the system; that would muck up your layout again. What you need is controls that can grow/shrink according to the space they need.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Store the size that the user selects in the Registry Settings for your Software and then Open your App next time, with those size settings that the user has chosen.
Regards, Graham
|
|
|
|
|
NNnnnnnnooooo don't use the registry, write it to the system folder for user data. the registry is so ... 90s
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Tell me about the System Folder please. I've only been programming in VB for about 25 years, so I might be missing something.
Regards, Graham
|
|
|
|
|
Graham Irons wrote: I've only been programming in VB for about 25 years So the 90's were your training ground, I started writing macros in Excel 1 somewhat earlier. There seem to be a plethora of old farts here on CP
Some places won't let you write to the registry and there is no guarantee someone doesn't want to go fiddle with the settings. User data folder is more specific if required and no more difficult to use than the registry. It is also probably faster.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am trying to download pricing data from Commonwealth Edison via their recently published Hourly Pricing API. This uses GETs from defined HTTPS URLs, and I have confirmed that typing the appropriate calls into a Web Browser results in the return of the data in the expected format. My code is as follows:
wc = New WebClient
strGet = "https://hourlypricing.comed.com/api?type=5minutefeed&datestart=201708040835&dateend=201708041035"
strResult = wc.DownloadString(strGet)
In the real Application, strGet is put together by other code, but I have checked that this is working correctly. The code here aborts with a ThreadAbortException in System.dll at the DownloadString call. If I substitute an HTTP location on one of my sites for Comed's HTTPS location in strGet, everything works as it should, and the file data is retrieved.
I have researched this and tried a number of suggested 'cures' for problems with HTTPS connections under VB.NET, but the problem persists.
Helpful suggestions welcomed!
|
|
|
|
|
 I've just tried that code, and it works fine.
[{"millisUTC":"1501860900000","price":"2.2"},{"millisUTC":"1501860600000","price":"2.2"},{"millisUTC":"1501860300000","price":"1.0"},{"millisUTC":"1501860000000","price":"0.7"},{"millisUTC":"1501859700000","price":"1.4"},{"millisUTC":"1501859400000","price":"2.1"},{"millisUTC":"1501859100000","price":"2.1"},{"millisUTC":"1501858800000","price":"2.5"},{"millisUTC":"1501858500000","price":"2.6"},{"millisUTC":"1501858200000","price":"2.6"},{"millisUTC":"1501857900000","price":"2.7"},{"millisUTC":"1501857600000","price":"2.6"},{"millisUTC":"1501857300000","price":"2.7"},{"millisUTC":"1501857000000","price":"2.7"},{"millisUTC":"1501856700000","price":"3.2"},{"millisUTC":"1501856400000","price":"2.5"},{"millisUTC":"1501856100000","price":"2.6"},{"millisUTC":"1501855800000","price":"2.9"},{"millisUTC":"1501855500000","price":"2.6"},{"millisUTC":"1501855200000","price":"2.5"},{"millisUTC":"1501854900000","price":"2.7"},{"millisUTC":"1501854600000","price":"2.5"},{"millisUTC":"1501854300000","price":"2.4"},{"millisUTC":"1501854000000","price":"2.4"},{"millisUTC":"1501853700000","price":"2.4"}]
There must be something else going on in your application, or a problem on your network.
Can you request the url from a browser running on the server?
Is there a firewall in the way?
Is your server configured to force an SSL v2 / v3 connection, or otherwise disabling TLS?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
My browser delivers the content of the URL without problems.
I do have a regular (McAfee) firewall, but, as noted, it is not interfering with the browser accessing the same location.
I have no idea how Comed's server is configured. I have a fairly standard install of Windows 10, and am having no difficulty accessing other sites, including a lot which use SSL.
Running exactly the code I gave as a standalone function produced the same error on my system, but it also produced the following 'informational' message from VS: "Evaluation requires a thread to run temporarily. Use the Watch window to perform the evaluation." I wonder if this is a debugger issue. I have to drop this for now, but will return to it and report back in a couple of days when I can get back to it.
|
|
|
|
|
The problem seems to be what I can only describe as a deficiency in the Visual Studio environment - the clue was the information message described in my previous response.
My usual way of testing an isolated Sub or Function while I am developing an application is either to invoke it directly from the Immediate Window, or, if this is not convenient (as it frequently isn't), to write a stub Sub which uses it and invoke that from the Immediate Window. This has always worked for me before. It appears that there is an issue with doing this to test (at least some) WebClient code, presumably because of some aspect of how code invoked from the Immediate Window is interpreted and run. If I put the code clipping from my first message in the Form_Load Function of a Windows Forms App and run the App, the code runs normally and returns the expected JSON string. If I put the identical code in a Public Sub and invoke the Sub from the VS Immediate Window, it throws the ThreadAbortException that I originally described. Perhaps the most bizarre aspect of this is the fact that the misbehavior is dependent on the URL in the request being an HTTPS one - as I noted, requests involving HTTP URLs are handled correctly, even when the code is run from the Immediate Window.
|
|
|
|
|
I am writing a client program in VB6 which will interface to a server over HTTP. The company who runs the server provided me with a certificate file called SomeCertificate.p12.
My program is running on Windows XP. This is the operating system the customer is using.
I am trying to find how to use this certificate when sending requests to the server.
Here is what I have done so far:
- Copied the certificate file to my test computer.
- Using Internet Explorer V8, I did "Tools|Internet Options|Content|Certificates|Trusted Root Authorities" and imported the certificate.
- Installed the winhttpcertcfg tool.
- Ran the following from command prompt:
"winhttpcertcfg -i SomeCertificate.p12 -c LOCAL_MACHINE\My -a COMPUTERNAME\USERNAME -p PasswordFromServerCompany"
the output was something like this. I replaced the different tokens with dummy strings:
Imported certificate:
CN=string1
OU=string2
O=string3
L=string4
C=string5
Private key access has already been granted for account: COMPUTERNAME\USERNAME
- My VB6 code looks something like this:
Private WithEvents m_ServerObj As WinHttpRequest Set m_ServerObj = New WinHttpRequest m_ServerObj.Open "GET", "https://serveraddress"
Call m_ServerObj.SetClientCertificate("LOCAL_MACHINE\Personal\SomeCertificate")
m_ServerObj.Send TextToSend
The Send call causes an exception: "A certificate is required to complete client authentication"
I tried different strings in the SetClientCertificate call but I keep getting the same error.
I'd appreciate any help and tips. What am i doing wrong? Is my code wrong? Did I use winhttpcertcfg incorrectly?
thank you.
modified 25-Jul-17 2:12am.
|
|
|
|
|
|
Thank you.
I think the "-s" option cannot be used with "-i". I tried to add it, but the utility just printed it's syntax text, as if the parameters were incorrect.
Like so:
winhttpcertcfg -i CertificateFile.p12-c LOCAL_MACHINE\My -s CertifiaceFile
-a COMPUTERNAME\USERNAME -p PASSWORD
on the other hand, it was accepted with "-l":
winhttpcertcfg -l -c LOCAL_MACHINE\MY -s CertificateFile
|
|
|
|
|
VB6 has effectively been "dead" for over 15 years. You'll struggle to find documentation or support for it, since most people have moved to .NET by now. With the release of Visual Studio Community[^], so long as you're within the limits, you can upgrade for free.
The only issue is, Windows XP doesn't support anything above .NET 4.0. But support for Windows XP ended over three years ago[^]. Aside from the occasional notable exception[^], your customer's computers have not received a security update for any vulnerability discovered in that time. Since it seems they're connected to the internet, they're ticking time-bombs waiting to destroy the network.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The fact i am using VB6 right now should not matter. The program is using Windows winhttp.dll, a COM object. I could have used C++ and still have the same problem.
|
|
|
|
|