|
Hi Masters,
I have a payment form, in this form, I have a datagridview which listed all the invoices of a certain customer. when I press okay to pay, all of the listed invoices should be updated with close. Here is the code i used and its not working.
Private Sub updateinvoicepaymentstat()
conn.ConnectionString = "Server = '" & Servername & "'; " _
& "Database = '" & DBName & "'; " _
& "user id = '" & sqlUName & "'; " _
& "password = '" & sqlPwd & "'"
conn.Open()
For x As Integer = 0 To dgvinvoicedetails.Rows.Count - 1
Dim sqlcommand As String = "UPDATE purchaseinvoice SET partialpay=@bal where docentry ='" & dgvinvoicedetails.Rows(x).Cells(0).Value & "'"
Dim command As New SqlCommand(sqlcommand, conn)
command.Parameters.AddWithValue("@bal", txtoutbal.Text)
command.ExecuteNonQuery()
command.Parameters.Clear()
Next x
conn.Close()
clear()
End Sub
Your help is much appreciated..
Thanks
Fbanz12
|
|
|
|
|
You are not checking the return value from ExecuteNonQuery to see whether the call succeeded, so you have no idea what is happening in your code. Add proper error checking, and log, or display information if the call fails. You can also use the debugger to check the actual values of any variables used by the UPDATE statement.
|
|
|
|
|
Hi Richard,
Thank you for the quick response. Do you have a sample where the result returns what I require to have. I am confused
Thanks a lot
Fbanz12
|
|
|
|
|
Sample code will not help you debug the problem, which is what you need to do first. Either follow my suggestion about logging, or use your debugger to step through and examine all variables.
|
|
|
|
|
On top of what Richard said, you're using a SqlParameter object for one parameter but not the other? Why? ALWAYS use parameter objects for every parameter! NEVER use string concatenation to build an SQL query.
System.ItDidntWorkException: Something didn't work as expected.
-- said no compiler, ever.
C# - How to debug code[ ^].
Seriously, go read this article.
Dave Kreskowiak
|
|
|
|
|
(I am sorry if this is an old question - the search mechanism doesn't work today: If I click a hit list entry, it doesn't show that message, but goes to the top of the forum; I don't get to read the question/answer.)
I started out in Win7 using constants for identifying extended file system attributes (such as "Link target"). Then came Win8, and I learned the truth of "Constants ain't; variables won't": I had to check the OS version and select the attribute number from one of several tables. Win10 came with yet another set of "constants" to select the attributes - yet another table.
Then came a Win10 update that changed the constants again - but still the OS identifies itself as Win10. Rather than adding another table for (potentially) each OS update (they were compiled into the code, so a new revision meant I had to distribute a new version of my code), I changed the strategy to dynamically build a table of attribute names, their index in the array being the attribute number. (You get the attribute name by calling GetDetailsOf with 0 as the first argument.) This has worked for some time.
Then comes this guy from our development group in Poland, complaining that my code doesn't work. After an extensive search, it turns out that it fails when he is running the code on a machine with a Polish Windows version: GetDetailsOf(0, AttrNo) returns the Polish attribute name. When my code looks for, say, "Link target" in the table, it won't find it.
I could make those guys provide a list of the Polish names, so that I search for either "Link target" or whatever Link target is in Poland. I will have to compile a new version, then the Polish guys will be happy. Maybe our Finish office will come three months later and tell that they have switched to Finish Windows versions (currently they use an English/US version), and I have to make a new version looking for either the English, the Polish or the Finish attribute name.
Is there no way to identify a given extended attribute in a general way, independent of language version, independent of OS version? A way that works in Polish Windows even of I don't know the Polish attribute names, in Finish Windows even if I don't know the Finish names, or in any other languge where I don't know the terms?
I am NOT going to translate the entire UI to umpteen languages - I am making programmer's tools, and a programmer can use an English language UI. What I need is to get the information from the file system in a language independent way!
|
|
|
|
|
If you ask for the name of an item then you will get it in the local language. You could try setting the default culture to English in order to get the name you expect. But a better idea is not to try and get names and compare them to strings, but to check the type of the item as described at FolderItem object (Windows)[^].
However, I may have misunderstood your question as it is not exactly clear what you are trying to achieve.
|
|
|
|
|
Are you sure that any Windows version is equipped to switch to any culture? Or am I doing it wrong? I try:
CultureInfo culture = CultureInfo.CreateSpecificCulture("fr-FR");
CultureInfo.DefaultThreadCurrentCulture = culture;
Thread.CurrentThread.CurrentCulture = culture;
attrnames = new string[400];
Folder rFolder = GetShell32NameSpaceFolder(_sysRoot);
for (int attrNo = 1; attrNo < 400; attrNo++) {
string attrName = rFolder.GetDetailsOf(0, attrNo).Trim();
attrnames[attrNo] = attrName.Empty() ? null : attrName;
}
- as you can see, I both set DetfaultThreadCurrentCulture and CurrentThread.CurrentCulture. The table is still filled with English attribute names, rather than French. I sort of doubt that any Windows installation can take on any culture from any place in the world - it may be possible to install it, but it is not necessarily install it.
My immediate need right now is when I have detected that a file is a symlink / junction, to know programmatically what the link refers to. If in Windows Explorer display the Properties of the file, it comes up as "Target:" in the "Shortcut" tab. In my current Win10 version, I can obtain the target path by
GetDetailsOf(196, );
- I find "Link target" in element 196 of the above table. In other Windows versions, the index is different, so I initialize the table at startup and search for the string "Link target" when I need to look up that attribute number.
I have not found any alternative way to get hold of the link target. (I could use a command shell, giving a dir command and parse the output - but what are the commands, and what shoult I look for, in a Polish language command shell?)
Later, I will make use of more of the attributes not available through the basic attributes, such as the media description attributes (e.g. Duration, Frame width, Frame rate, ...) or author info. If there is another (language/version independent) way of obtaining the target of a symbolic link, I would be helped in the short term, but in the long term, I would need programmatic access to a whole lot of these attributes, preferably all those that can be displayed as an Explorer column.
This information is saved in the file system. I would be extremely surprised if each attribute value is tagged with a language specific attribute name. I would also be surprised if they are tagged with the index I see and use through GetDetailsOf - then, any Windows update would require a re-tagging of every file on every disk, and I couldn't take that disk over to an older version OS without loosing the attributes. Which identification mechanism is used in the NTFS metadata to recognize, say, the link target, or the video frame rate? Is there any way I can ask by the same ID that is used internally within the NTFS file system?
|
|
|
|
|
You can refereto the link in my previous message to see how to test for a link. See Reparse Points (Windows)[^] for information about junctions.
|
|
|
|
|
It seems as if DeviceIoControl has not yet been wrapped up for C# access. While I certainly could spend the resources doing that, it certainly will be very much a short-term solution, solving only one of my needs. As I wrote in my previous post, I will need acess to a bunch of these attributes, and the other ones are not available through DeviceIoControl. The effort spent for solving a fraction of the problem is wasted when I find a more complete solution.
If I ask those Polish guys what "Link target" is in Polish, I can solve my immediate problem with a small fraction of the effort of learning the intricasies of DeviceIoControl and making a C# interface to it. (I did program IOCTL in the old DOS days, and I am convinced that this modern variant is no less complex when I start digging into it.)
|
|
|
|
|
Without knowing all the details, my impulse is to use an optional translation table.
If there is an entry in the "table" for a given word, use the "other" word to do the lookup, etc.
The table either exists or does not exist. If it does exist, it has one or more entries.
Note that nothing was said about a given "language".
The table could even be "user maintained" locally.
(I used a "translation" table once to confuse normal system commands (an Amdahl engineer joke)).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Hi Programmers,
Have you ever practiced coding online to prepare a technical interview or to groom your skills? If yes, how well it was? Which websites have you used? And, how effective they were? If possible, share the challenges you have faced?
|
|
|
|
|
Websites can offer you the basics but you need experience for most interviews, as you never know what real life question may be thrown at you.
|
|
|
|
|
|
I have seen pointless questions about very specific api things. For example a number of people want to discuss Big O notation in regards to specific collections. Pointless because it just doesn't reflect anything about normal current business programming.
You can find example interview questions and then do them, since you might get lucky and have them ask you that same question. Because they might have done exactly the same query.
|
|
|
|
|
Kindly reply to my mail box vinothsrivi@gmail.com if u could educate me on .net core with microservices and sql server with MSBI and azure deployment with one-one in online.
|
|
|
|
|
|
You forgot to tell people how much you are willing to pay for tutoring or were you expecting that we'd do it for free?
This space for rent
|
|
|
|
|
Hi Pete O'Hanlon
Thanks for the response I did not said that I am looking this with free of cost. I just want to see how the tutor can capable of delivering the contents with one demo. Then if is really satisfiable then I am ready to pay our market fee.
|
|
|
|
|
Yeah, your naivety is cute. That's not going to happen, anywhere.
You're simply not going to get a CUSTOM BUILT, just for you, series of training classes over the web for free., not even a SINGLE "try before you buy" session.
You're talking about over a hundred hours of instruction based on the topics you posted, and that's only going to scratch the surface of everything.
System.ItDidntWorkException: Something didn't work as expected.
C# - How to debug code[ ^].
Seriously, go read these articles.
Dave Kreskowiak
|
|
|
|
|
It would be best if you didn't post your email address is a public forum. The only people who care about it, or are going to ever use it, are spammers. Yes, they have bots that scan forums for anything that looks like an email address and adds it to their databases to throw tons of "male enhancement" spam at you.
System.ItDidntWorkException: Something didn't work as expected.
C# - How to debug code[ ^].
Seriously, go read these articles.
Dave Kreskowiak
|
|
|
|
|
How can i reverse this function so when i pass the output i get back the input
Dim text2 As String = ""
Dim num As Integer = 1
Dim num2 As Integer
Dim num3 As Integer
Do
' The following expression was wrapped in a unchecked-expression
Dim value As Integer = CInt(Math.Round(Math.Floor(CDbl((10.0F * VBMath.Rnd())))))
text2 += Conversions.ToString(value)
num += 1
num2 = num
num3 = 8
Loop While num2 <= num3
|
|
|
|
|
You can only do so if you know what sequence the VBMath.Rnd()[^] function returns. That's something the function is not guaranteed to do, so you can't.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
You can't reverse that function. Round and Floor are "lossy", meaning bits of data are lost when the functions are used on the data. It's impossible to get that data back and get the original number.
System.ItDidntWorkException: Something didn't work as expected.
C# - How to debug code[ ^].
Seriously, go read these articles.
Dave Kreskowiak
|
|
|
|
|
Hi there,
(Not sure which area to put this question in so forgive me)I have a word document but i'd like to convert it to HTML. I know i can convert from Microsoft Word to HTML document but are there any limitations or issues? if so what do i need to be aware of?
Can anyone suggest any suitable alternatives please?
|
|
|
|
|