|
Sorry Confused already delete fronm there
|
|
|
|
|
I want to add "wake the computer to run this task" scheduled task in condition tab in vbscript
|
|
|
|
|
Problème de mise à jour liée aux élément interdépendants de ma table
Bonjour chers membres du forum, j’ai une préoccupation qui est liée à la mise à jour de ma table.
En effet j’ai conçu une application vb.net pour la gestion des opérations de caisse pour le compte
d’une structure et tout fonctionne correctement jusqu’au niveau de la modification de la table où j’ai un bémol.
Le truc c’est qu’une opération est soit une recette ou une dépense d’où j’ai créé une variable
solde = recette - dépense (recette ou dépense est nulle selon la nature de l’opération) qui représente le solde
de chaque opération effectuée.
Pour ce qui est de la part du solde de la caisse à partir d’une opération op2 on a:
E: solde_caisse_op2 = solde_op2 + solde_caisse_op1 ( égal à solde_op1) et cela fonctionne bien en insertion.
Mon problème est que sur par exemple 10 opérations effectuées on décide de modifier la 5ème opération,
comment réajuster le solde de la caisse à partir de la ligne modifiée jusqu’au dernier élément de la table
solde_caisse, vu que les différentes lignes sont dépendantes pour le calcul des différentes soldes
de la caisse d’après l’équation E.
J’ai déjà réfléchi à une solution mais qui me donne une FatalError. En effet j’ai procédé comme suit:
Imports MySql.Data
Imports MySql.Data.Entity
Imports MySql.Data.MySqlClient
Imports MySql.Data.Types
Public solde_operation As Integer = 0
Public MaxId As Integer
Public j As Integer
Public soldecaisse As Integer
Public i As MySqlParameter
Private Sub GetMaxId()
connecter()
Dim sql As String
sql = "(SELECT MAX(Id_operation) FROM tbl_operation)"
Dim query As New MySqlCommand()
query = New MySqlCommand(sql, connecter)
MaxId = Val(query.ExecuteScalar())
connecter.close()
End Sub
Private Sub GetSoldeCaisse()
connecter()
Dim sql As String
sql = "select ((select Solde_operation from tbl_operation where Id_operation = @i) + (select Solde_operation from tbl_operation where Id_operation = @i-1))"
Dim query As New MySqlCommand()
query = New MySqlCommand(sql, connecter)
i = New MySqlParameter("@i", j)
soldecaisse = Val(query.ExecuteScalar())
connecter.close()
End Sub
Private Sub UpdateSolde()
connecter()
GetMaxId()
Dim sql As String
sql = "UPDATE tbl_operation SET Solde_operation = soldecaisse WHERE Id_operation = @i"
i = New MySqlParameter("@i", j)
Dim query As New MySqlCommand()
For j = Val(txt_num_operation.Text) To MaxId
GetSoldeCaisse()
query = New MySqlCommand(sql, connecter)
Next
connecter.close()
End Sub
En résumé la méthode GetMaxId() lors de son appel renvoie l'id_max de la table opération et cette valeur servira
de condition d'arrêt dans la boucle.
Ensuite la méthode GetSoldeCaisse(), quant à elle calcule le solde de la caisse au cours d'une opération donnée.
Enfin, la méthode UpdateSolde() qui sera appelée juste après celle qui effectuera la modification de la ligne
concernée, nous recalcule le solde de la caisse à partir de la ligne modifiée jusqu'au dernier élément de la colonne
car tous liés. La boucle for définit le début et la fin des modifications.
Je compte sur chacun pour la résolution de cette difficulté. Merci…
|
|
|
|
|
This is an English speaking site. Modify your question and replace your French text with English.
|
|
|
|
|
 Google translate: Hello dear forum members, I have a concern that is related to updating my table.
Indeed I designed a vb.net application for the management of cash operations for the account
of a structure and everything works correctly until the level of the modification of the table where I have a problem.
The thing is that an operation is either a receipt or an expense from which I created a variable
balance = revenue - expenditure (revenue or expenditure is nil depending on the nature of the operation) which represents the balance
of each operation performed.
As for the part of the cash balance from an op2 operation, we have:
E: balance_caisse_op2 = balance_op2 + balance_caisse_op1 (equal to balance_op1) and it works well in insertion.
My problem is that on for example 10 operations carried out we decide to modify the 5th operation,
how to readjust cash register balance from changed row to last item in table
cash_balance, since the different lines are dependent for the calculation of the different balances
of the body according to equation E.
I have already thought of a solution but that gives me a FatalError. I actually did the following:
[CODE]
In summary, the GetMaxId() method when called returns the id_max of the operation table and this value will be used
stop condition in the loop.
Then the GetBalanceCaisse() method, for its part, calculates the balance of the cashbox during a given operation.
Finally, the UpdateBalance() method which will be called just after the one which will modify the line
concerned, we recalculate the balance of the cash register from the modified line to the last element of the column
because all related. The for loop defines the start and end of changes.
I am counting on everyone to resolve this difficulty. Thanks…
From your description, it sounds like you're trying to build some sort of running total. But looking at your code, it's not clear how you're doing that, nor what the problem is.
Start by describing your table structure and providing some sample data. Then explain what you're updating, and what you want to happen when you update it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Deshalb speichern wir keine laufende Summe; es ist die Summe aller Datensätze in der Datenbank zu diesem Zeitpunkt. Sie speichern es nie, Sie berechnen es. Es ist nicht so dass es Jahre dauern wird. Schauen Sie sich auch das Erinnerungsmuster (memento-pattern) an.
And no, if you don't speak English, why would I bother to translate?
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.
|
|
|
|
|
hello all
how build a dns server software by vb.net
|
|
|
|
|
Well, you start by reading the entirety of RFCs 1034[^] and 1035[^] and completely understand all of it before you start thinking of writing code.
Oh, and I hope you're well skilled in writing TCP servers, and creating your own database to store the record data.
|
|
|
|
|
Dave Kreskowiak wrote: eading the entirety of RFCs 1034[^] and 1035[^] and completely understand all of it In other words: Give up, and never more bother us with questions about it ...
|
|
|
|
|
No, I'm dead serious. You either understand the entire spec or you're writing a server that doesn't work with clients.
You have no idea how much work is going to go into this project. It's not something you're going to bang out in couple of weekends, and you're not going to get description of how to do it in a forum environment where that description would take a three volume set of books to write.
|
|
|
|
|
|
How would you answer the question then?
You think telling someone to read the "spec", when they obviously haven't, is "harsh"?
How can you share a vocabulary when only one part speaks the language?
I'm ecstatic when there is a spec and I don't have to rely on someone's say-so or interpretation.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
|
Do not answer questions if you are upset
|
|
|
|
|
What I am trying to do is insert a buttons name into part of a URL so that instead of C&P 300+ pieces of code for individual items that I can just use 1 piece of code for the many different Items.
This is what I am using currently
formname.txtURL.text = "www.webaddress.com.html"
What I want it to do is:
formname.txtURL.text = "www.webaddress.com/(buttonnamehere).html"
What I am missing the piece I need to add for (buttonnamehere) So when the button is clicked, it would make it
http://www.webaddress.com/buttonsnames.html
Is this something that's possible to do?
|
|
|
|
|
Try this:
Dim ButtonName As String
ButtonName = Button1.Text
formname.txtURL.text = "www.webaddress.com/" & ButtonName & ".html"
|
|
|
|
|
Okay, so that would work for just 1 how would it also work for the other buttons on a Click statement?
Would it be just a mess of "If" statements? If Button2 then, If Button3, Then, etc?
|
|
|
|
|
How about:
In the click handler, you have the sender argument, correct? Put code into the click handler that casts the sender argument to a button object and grabs its Text property. And set every button to use that one click handler.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I have a service that will perform some kind of action depending on what the SessionChangeDescription is. The service is installed on a computer that autologs in. To make this happen this registry value needs to be set and is set during OnStart:
Key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon
Value: AutoAdminLogon
Data: 1
There is a Windows Form that will allow a domain user to log in and the service will change the AutoAdminLogon value to a 0. When a power outage occurs and power is restored the PC, the computer does not autologon cause the registry value AutoAdminLogon is not set back to a 1 yet. I normally just send a logoff, tsdiscon, or restart to the computer through SCCM and it will autolog again. These are my questions:
1. Is it possible to logoff or disconnect a session through the service at a logon screen?
2. Is it possible to trigger one of the SessionChangeDescription without any session changes?
3. Restart the computer through the service?
What I have tried:
At OnStart, get the AutoAdminLogon value and if it a 0, then do one of these:
ExitWindowsEx function, WTSDisconnectSession function, wmi to logoff a session, tsdiscon.exe, logoff.exe, shutdown.exe, and LockWorkstation function.
None of them work. If I do the same through SCCM, the computer autologs in.
|
|
|
|
|
Nevermind. Looks like I guessed a bunch of times and was able to figure it out. Even though in SCCM, I only use tsdiscon and the account used is the SYSTEM account, it works. It doesn't apply in this scenario. Using tsdiscon 1 (Session 1) works or WTSDisconnectSession function with a 1 for Session 1 also works.
|
|
|
|
|
I am not using Visual Studio these days. I use C and C++, or at least I am trying to learn to use C and C++.
I remember putting over 1,000,000 entries into a listbox and then being able to read all of them back.
I also remember the listbox sorting that entire 1,000,000 entries correctly.
Who else has noticed this capacity?
And, as a follow up question: Does the latest version of Visual Studio have this capacity for it's listbox?
Thank you.
|
|
|
|
|
Visual Studio has nothing to do with this. The limits of the controls are imposed by the control libraries in Windows and .NET.
Why on earth would you put a million items in a ListBox, or any other control for that matter? It'll take forever to populate unless you use "virtual mode", and, as a user, would you want to navigate through all that? Of course not! So why would ever do this?
|
|
|
|
|
@Dave Kreskowiak, Why on earth would you not want to know the actual limits on controls? Microsoft has wrongly stated constraints in the past and it would take forever to find out if they were right or wrong if no one ever tested them. Wrong about the virtual mode. It did not take forever to populate. It was fast. Why assume that virtual mode would be the default avenue of effort? Of course I did not use virtual mode. That would have been a waste of time. Is that how you personally would do testing? Why would you even think of using virtual mode? Is that how you think? Are you so boxed into virtual mode that you assume it?
Why would you never test the limits of Visual Studio?
How would a mechanical engineer know the strain hardening within the stress/strain curve (Young's modulus) of various materials if no one ever tested such?
How would an aeronautical engineer know the travel of the shock-fit across the surface of a supersonic Joukowsky airfoil at various speeds if no one ever tested it?
How would an electrical engineer know that at ultra-high voltage the electrons leave the man-made electrical conducter and follow a plasmatic cloud self-created by those electrons if no one ever tested it?
Think before you answer! At least think before you answer me.
To test, of course. An Aeronautical, or Civil, or Electrical, or Electronic, or Mechanical, or Structural engineer would know that. I would guess that even a Systems Engineer would do testing, but I may be wrong.
I did not ask for your opinion on Visual Studio. I asked who noticed this capacity. You did not even answer the question. You went on a tangent.
Please allow people that, "noticed this capacity" to answer the question.
|
|
|
|
|
I never said testing the limits of the controls was irrelevant. Those are technical limits. Using the controls is subject to the usability limits of users. Sure, you can put a million items in a listbox. Now what?
Putting a million items in a control is putting your users through navigation hell. Are you seriously going to expect users to search through that many items to find the one, or more, they want? If you don't code for the limits of your users, they uninstall your app.
Technical limits are only one aspect of the "limits" you should be concerned about.
|
|
|
|
|
@Dave Kreskowiak, your wisdom about focusing on users I accept.
I explained in a different reply (to Gerry Schmitz) in this thread why I wanted the sort and what I had discovered.
The list and the sort would not necessarily be for the user to see, but for my internal use. And, by using a list box sort I did not have to include a sort of my own in code and could keep the final file size smaller. Microsoft has some very nice code already written that behind the scenes does some amazing things fast. I used their years of experience and army of coders to speed up my program and lessen the final size of it.
But, I was still left with the question of "How did they do that?" So, now I am attempting to devour C and C++ as fast and as thoroughly as I can. Read, study, code, try not to pull out hair, ask here, repeat.
Thank you.
|
|
|
|
|