|
Sorry: I can not make it works
Here a few word and how it works
First, we call the WS:http://..../wstest/get.asp?cmd=Agencias
In the code:
'Read the Request.QueryString("cmd")
sAction = Request.QueryString("cmd")
'Checked the action, action do not recives any param at all
'Then calls, depends of the action, a function
Select Case UCase(sAction)
Case "SUCURSALES"
Call getAgenciasJSON()
Case "CEDULA"
Call getCedulaJSON()
Case "RNC"
Call getRNCJSON()
Case Else
sErrorKey = "invalid_key_value"
sErrorMessage = getDictItem("Common.InvalidKeyValue")
Call SetUpJSONfail()
End Select
'This a function. All functions are like this
Sub getAgenciasJSON()
Dim sSqlWrk, rswrk
sSqlWrk = "SELECT * FROM [" & xDb_Catalog_Str & "].[dbo].[SUC_MAESTRA] as x with (nolock)"
sSqlWrk = sSqlWrk & " WHERE (x.[SUC_ESTADO] = 'A')"
sSqlWrk = sSqlWrk & " ORDER BY x.[SUC_DESCRIPCION]"
Set rswrk = conn.Execute(sSqlWrk)
oJSON.LoadRecordset rswrk
Set rswrk = Nothing
oJSON.Write()
End Sub
'This is the new function, which of course needs a param,
'The question is: How can i read o pass the param using: http://..../wstest/get.asp?cmd=cedula=784512422
' because cedula need a param. How can i read the param using sAction = Request.QueryString("cmd")?
'
Sub getCedulaJSON()'
Dim sSqlWrk, rswrk, sCedula
'How can i get the param cedula and it value in order to make the select
sCedula = Request.QueryString("cedula")
sSqlWrk = "SELECT nombres, apellido1, apellido2 from cedulados where trim(mun_ced) + trim(seq_ced) + trim(ver_ced) = '" + sCedula + "'"
Set rswrk = conn2.Execute(sSqlWrk)
oJSON.LoadRecordset rswrk
Set rswrk = Nothing
oJSON.Write()
End Sub
|
|
|
|
|
It is not simple to parse something like http://..../wstest/get.asp?cmd=cedula=784512422 but it is easy to parse something like http://..../wstest/get.asp?cmd=cedula&value=784512422 . Just use Request.QueryString() to get the value. Start your select case as before e.g.
sAction = Request.QueryString("cmd")
Select Case UCase(sAction)
Case "SUCURSALES"
Call getAgenciasJSON()
Case "CEDULA"
Call getCedulaJSON()
Case "RNC"
Call getRNCJSON()
Case Else
sErrorKey = "invalid_key_value"
sErrorMessage = getDictItem("Common.InvalidKeyValue")
Call SetUpJSONfail()
End Select and then check for the value in the subroutine. Viz:
Sub getCedulaJSON()
Dim sSqlWrk, rswrk, sCedulaValue
sCedulaValue = Request.QueryString("value")
sSqlWrk = "SELECT nombres, apellido1, apellido2 from cedulados where trim(mun_ced) + trim(seq_ced) + trim(ver_ced) = '" + sCedulaValue + "'"
Set rswrk = conn2.Execute(sSqlWrk)
oJSON.LoadRecordset rswrk
Set rswrk = Nothing
oJSON.Write()
End Sub
----------------------------------------------------------------------------------
Not an answer to your latest question but ...
I noticed that on 29 July you had code starting with
Select Case UCase(sAction)
Case "SUCURSALES"
Call getSucursalesJSON()
Case "AGENCIAS" and now you have
Select Case UCase(sAction)
Case "SUCURSALES"
Call getAgenciasJSON() I suspect that you have just mis-copy/pasted and actually want
Select Case UCase(sAction)
Case "SUCURSALES"
Call getSucursalesJSON()
Case "AGENCIAS"
Call getAgenciasJSON()
|
|
|
|
|
Thanks to everybody: IT IS WORKS.
Thanks a LOT
|
|
|
|
|
My motherboard finally died, so I figured I would upgrade my PC. I am running windows 10, which I was running on my old system. I tried to re-install an older version of Office but found out that windows 10 does not support the older versions, so I upgraded to Office 2019.
I have a number of Access applications, that are now missing ActiveX controls I use on a number of forms. I can not find a replacement for the worksheet control (OWC11), how have other people been solving this?
There is an ActiveX calendar control listed (Calendar Control 12.0) but when I select it I get a OLE server is not register error, but I have no idea where to find the control.
Any help with upgrading would be appreciated.
|
|
|
|
|
Ken Kazinski wrote: My motherboard finally died, so I figured I would upgrade my PC Then.. how are you posting??
Ken Kazinski wrote: I have a number of Access applications, that are now missing ActiveX controls I use on a number of forms. I can not find a replacement for the worksheet control (OWC11), how have other people been solving this?
By migrating away from Access. Did you not get the memo?
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I would install a "supported" OS on a virtual machine (VMBox; Hypervisor) and rebuild there. I have an XP box for my car's service manual app because it's that old.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hi Gerry,
Thanks that is a good idea, but I have Win 10 Home so I can't run the hypervisor, but I do have a copy of VM Ware Workstation and that can get me over the hump.
Still looking for the replacement controls while I refactor the code to another platform.
|
|
|
|
|
Maybe "Any CPU" is the final key.
owc11.exe for office 20120 - 64 bit
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Most people I know are avoiding the ActiveX controls entirely. I came across this a few years back - MS Access - Calendar/Date Picker Control | DEVelopers HUT[^]
I think we went for the UtterAccess one in the end but it was at a different job and my memory isn't the best. It would have been Win7 then too but by all accounts Pete has been keeping it up to date - the comments seem to suggest that it is fine on Win10
|
|
|
|
|
My old PC has been flagged by MS as incapable of loading Windows updates for 18 months due to its antiquity so I, too, have migrated my old (20+ years) MS-Access apps (which get a lot of use) to a new PC with Office 2019 but the new PC is not yet my main one. As a result of your question, I have checked one of my old apps. For dates, I have Date/Time fields in the underlying tables and display using TextBoxes. I can confirm that even in O2019 there is still a date picker displayed when these fields have focus / are clicked on. You may be able to use the same technique (Date/Time field shown as a TextBox) as an alternative way of selecting dates if you cannot get your ActiveX control to work.
Re other responses: Yes, I did get the memo to move away from MS-Access. But, as a single user, I have never had any problems and follow the "If it ain't broke, don't fix" principle. Plus, I have yet to find any other environment that enables you to have a database, code, forms etc under a single roof that can be changed on the fly if needed. I would like to move off MS-Access as it has only been supported in Pro versions of Office since 2003, but it has served me well since it first came out. Some of my apps have been on MS-Access 1.0 / 1.1 / 2.0 / 97 / 2003 / 2007 / 2016 / 2019 with only minimal changes (even the move from AccessBasic to VBA only really affected a change in the RecordSet class and a few error codes).
|
|
|
|
|
I agree. I use the database for my own project and over the years the numbers of lines of code has grown to an impressive number.
I will give the text box idea a shot. I use the unbound textbox to stop my code from running at a certain time.
|
|
|
|
|
I was able to find the OWC11 installer on the CNET download page. I installed it and it has been working well. I did have to recreate the controls on my forms but at least things are working again.
|
|
|
|
|
Please I am developing a project for boutique and I want to upload pictures of items. I need the code to o that on one single form
|
|
|
|
|
It depends on whether this is a Windows application or a Web application, and where the pictures are stored.
|
|
|
|
|
Well, the only code you're going to get is the core YOU write.
There is no "THE code" to do that. There's a myriad of ways of doing things, but like Richard said, what your options are is going to be dictated by the type of application you're writing.
|
|
|
|
|
Function CheckLogin(ldap as string, usr As String, pwd As String) As Boolean
Dim Success As Boolean = False
Dim Entry As New System.DirectoryServices.DirectoryEntry(ldap, usr, pwd)
Dim Searcher As New System.DirectoryServices.DirectorySearcher(Entry)
Searcher.SearchScope = DirectoryServices.SearchScope.OneLevel
Try
Dim Results As System.DirectoryServices.SearchResult = Searcher.FindOne
Success = Not (Results Is Nothing)
Catch ex As Exception
Success = False
End Try
Return Success
End Function
Hi! I'm having a little trouble with the caret (^) character.
I'm using System.DirectoryServices.DirectoryEntry to verify the AD user.
The problem is when the password has a caret character at the end (E.g. zpfrt^), it returns a FALSE value. Even I tried to enclosed it in [], (), "", and {}, it doesn't solve the problem. I also tried this one - ^^^^, it still not working.
Do you have any idea how to fix this?
If I told the user to change his password without using the caret character, he might say "Windows accept my password with the caret character, why should I change that?" lolz
Please let me know if you have a solution. Thanks in advance guys :)
modified 9-Jul-21 4:01am.
|
|
|
|
|
Solution to what? You haven't shown the code you're using.
|
|
|
|
|
Forgot to post the code, sorry..
|
|
|
|
|
OK, if you're looking to authenticate the credentials provided by the user of your app, it's much simpler to do this:
Imports System.DirectoryServices.AccountManagement
...
Dim isValid As Boolean
Using (pc As PrincipalContext = New PrincipalContext(ContextType.Domain, "YourDomainName"))
isValid = pc.ValidateCredentials("username", "password");
End Using
But, the ^ character is legal in all cases in Active Directory. It doesn't need to be escaped at all.
|
|
|
|
|
Thanks for the reply Dave, your code is simple and great, but it still returns a False value when a caret is on the end of the password.
I forgot to tell - the code is used for a console application. It displays MORE? when I executed it, and I just press ctrl+x to stop the process.
Even if I put four (4) carets, it still returns a False value.
It doesn't produce an error exception, so the code is good..
Can't attach an image here, so I just post a link and see for yourself.
LDAP - Download - 4shared - Uchiha Yueh[^]
But still thanks for the help Dave, I love the simplicity of your code..
|
|
|
|
|
The check will fail if the password is required to be changed or if the password has expired.
Other than that, it's going to be a question for Microsoft.
I don't have an AD setup to test against and there's nothing on the web about the problem of a caret at the end of a password.
Wait, wait, wait. It's been a LONG time, but the caret in a CMD prompt is used by the CMD prompt as an escape character, so it's not really being passed to your code. You can check this by setting a breakpoint on your code to check the credentials and look at the value of 'password' when the breakpoint is hit.
modified 10-Jul-21 11:26am.
|
|
|
|
|
I also don't have an AD setup here at my house.
I'll try it on Wednesday (Phil. Time) at the office and I'll post the result here.
Thanks for your help ^_^
|
|
|
|
|
Dave Kreskowiak wrote: the caret in a CMD prompt is used by the CMD prompt as an escape character But only when typing a command sequence into cmd. Using cin, scanf or similar it is passed direct to the calling application.
|
|
|
|
|
The command line is exactly where he's typing the password, for whatever reason.
|
|
|
|
|
Yes I discovered that after I posted my message to you. But using double quotes round the password fixes it. However, not the best way of doing such an application.
|
|
|
|