Click here to Skip to main content
15,881,600 members

Comments by jsc42 (Top 41 by date)

jsc42 29-Mar-23 6:34am View    
OP says Oracle, not SQL SERVER; Oracle does not have a DATEADD function. https://stackoverflow.com/questions/4957224/getting-last-day-of-previous-month-in-oracle-function says use LAST_DAY(ADD_MONTHS(sysdate, -1))
jsc42 23-Mar-23 6:04am View    
I am guessing that your problem may be with the lines 'if (ItemsDataGridView.Rows.Count % 2 == 1) { pdfTable.AddCell(" "); }' which only add a cell if there are an odd number of rows. I suspect that you are looking for more than 2 rows e.g. 'if (ItemsDataGridView.Rows.Count > 2) { /* etc */}'. But, as I do not know anything about the PdfTable object, I could be completely wrong.
jsc42 1-May-22 17:37pm View    
That algorithm (plus most others) needs a seed to generate the value. The seed should be randomly chosen, which takes us back to square 1 again unless you have some other pseudo-random number generator to start with (e.g. current time as milliseconds since the epoch mod some large no). Alternatively, see https://xkcd.com/221/ but I doubt that that would be acceptable in the OP's situation.
jsc42 22-Apr-22 12:57pm View    
The settings would have to be User, not Application. But it is the wrong place to save it. You want something that is pan-user, in case a different user uses your application. I assume that the registration details are being saved to a database, so the best place is the save the value in a table in the database.

Also, I note that you are setting StudentNumber as an increment of studentTotal, which you are setting to zero at the start of each run. This is another reason you are restarting the count each time.

Finally, for now, if you have 50 children who attend 200 days a year your counter will roll over from 9999 back to 0000. It would be better if the id number was independent of the year so it can grow as big as it needs.
jsc42 22-Apr-22 12:47pm View    
IE is not completely dead! Somewhat moribund - more like a walking zombie. You can still use CreateObject("InternetExplorer.Application") in a Windows Script File or a Hypertext Application and it starts an IE window. The standard DLL XHTML? is effectively IE7 (so HTML4 + CSS1.0 + JS1.2) but it still works even on Windows 11. ActiveX, therefore, limps along even today.

However, I concur that it has the potential to be a massive security problem and should be avoided like the plague. I only use it for a couple of very old utilities that I wrote for myself years ago, so I know what the safety risks are with them. I would never pick something off the shelf that used ActiveX and have no intention of writing anything using it in the future.

Caveat Emptor!