Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If I substitute some values and evaluate the first expression I get

UPDATE ptransaction  SET Quantityt = 23, Partial_totalt='24' WHERE Product_Codet =CODE''AND  soldtime = '2017-02-26 09:10:57'

You probably intended something like

UPDATE ptransaction  SET Quantityt = 23, Partial_totalt=24 WHERE Product_Codet ='CODE' AND  soldtime = '2017-02-26 09:10:57'

Check out the placement of your single quotes, especially after =CODE which is followed by two single quotes. You can avoid the hassle of composing queries by using parameterized queries.

Santanu.Das commented: Perfect & awesome +8
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

After line 18 you add some code to the effect

if (pledge >= 100)
        {
            numMugs++;
        }
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can find that here.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you are only interested in the number of rows of something then do

SELECT COUNT(*) FROM test [WHERE...]

Doing

SELECT SQL_CALC_FOUND_ROWS * FROM `test`

is a waste. In the first case, all the db has to return is the record count. In the second case it has to return all of the rows.

cereal commented: thank you! +14
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can also try setting the focus to a particular control instead of relying on the tab order

TextBox5.Focus()
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Unless the textbox is set to multiline it will never contain a vbCrLf.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Did that clear up the problem?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You might try just rebooting your router. I have to do that periodically when my connection bogs down (only 3 computers on it). As soo as it restarts my connections speed up considerably. There is no way I can see what the problem is but I suspect router tables are getting too large (or possibly scrambled).

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I get about 600,000 results if I google how to do recursion in c++. Have you looked at any of those?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you are populating the Listview/DataGridView in a loop then I suggest you disable updates before you start the loop then enable them after the loop. This will save you a lot of processing time doing unnecessary control updates.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Even though I am clearly debating ^_^

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In mathematics, when a range is specified as (a,b) it is referred to as an open range and does not include the endpoints. When it is specified as [a,b] it is a closed range and does include the endpoints. A programming language should be consistent. When I see (a,b) I expect (and rightly so) to see consistent behaviour. A desired feature of a language is that the expected behaviour should be the actual behaviour. I accept that this is the way Python was designed. I maintain my opinion that it is wrong, no matter how convenient that behaviour is.

Perhaps they should have allowed range(a,b), range[a,b], range(a,b] and range[a,b). That would be consistent with mathematical definitions and would still allow the convenience for coding.

There are many programming tricks that are convenient but are still strongly discouraged because they are lack clarity. But this is probably not the thread to hold this debate (again).

rproffitt commented: Endpoints. Gotta love 'em. +11
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

INABIAF. It's not a bug. It's a feature. As much as it has been "explained" as to how this makes programming easier I still consider it a failing of the language. Range generates numbers starting at the first number and proceeding by the increment up to but not including the second number. So in order to get the numbers from 1 to 10 you have to use range(1,11). I always favour clarity over everything else so this design choice offends me.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Why do you need a program to "launch" another program? I clicked the "learn more" button on their website. The first time it brought up a betting site, the second time it tried to bring up a page that was blocked by my antivirus software. Seems like a bad idea to me.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Another suggestion which won't help you this time but definitely will next time. Install Macrium Reflect. I have the free version and I have it set to automatically image my C partition with a full image done on the first of every month and a differential every day. Mind you, this really is practical only if you have your system set up like mine which is

C:   OS and Apps

D:   Everything else. 

I relocated all of my user folders (My Documents, My Videos, My Music, etc) to equivalent folders on D:. I have had several occasions where I have had to restore an image. Sometimes it is easier to restore an image than it is to try to undo unwanted changes. If you upgrade to the paid version you can do incremental rather than differential images.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you have the room and the user folder is not too big you might try to just copy the guid-named profile to the correct username. At least this would preserve the original in case that doesn't work. If you don't have the room then just rename the guid-named folder to the correct username.

When new user profiles are created, all Windows does is copy a default user profile into a folder with the new user name.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

A surgeon's job is not necessarily to operate but to operate only when absolutely necessary. I see most programming jobs in the same light. My job as a programmer was not necessarily to write code but to provide solutions to problems. If code was best solution then I wrote code. There were a lot of cases where code was not required.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I found that anything important in a meeting got said within the first 15 minutes. As such, I had a program that I could set to send me a text message about 15 minutes in. If I decided the meeting was worthwhile I would stick around. If not I could just say "sorry, I have to take care of this" and leave.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I posted this code snippet a while back that I think will show you how to do what you want.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I usually do a clear with CTRL-SHIFT-DEL. What happens when you try that?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Are all of the SQL related services currently running (check by running services.msc)? What is the name of your SQL instance and how are you trying to connect? Please provide a connection string if you have it.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It's here now

Well, almost. In the US, at least, the major providers have little incentive to actually make major improvements to infrastructure that would provide substantial improvements. They have taken billions of dollars that were intended to make these improvements and instead just kept them. In some cases they have actually blocked improvements in services by preventing some cities from providing services that would compete with the big (privately owned) ISPs. Why improve services when you can just keep a monopoly and charge what you want?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It is bad practice to have duplicate data. That could lead to inconsistencies. I advise you to store the date as one column and create a view with the derived columns. That gives you non-redundant columns plus the convenience of pretending that the derived coulmns actually exist (simpler queries).

diafol commented: My thoughts too +1 +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You saw where I loaded the values into the text fields for frmDetails. Retrieve the details from the database and populate the DGV on frmDetails the same way you populate the DGV on the main form.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you are concerned about inadvertantly borking something by using a command like netsh that you are unfamiliar with you might use the following script code that I wrote up. It executes the netsh command in a very restrictive fashion. You can use it in three ways:

  1. metered
  2. metered <profile>
  3. metered <profile> ON | OFF

The first form lists all wi-fi profiles. The second form (if you give it a profile name from the first form) will display the metered status of that profile. The third form will allow you to set the metered status on or off for a given profile. Copy the folllowing code and save in a file named metered.vbs. Run it from within a command shell. See the notes in the file header.

'
'   Name:
'
'       metered.vbs
'
'   Description:
'
'       Command line utility to set an internet connection to metered
'       or non-metered
'
'   Usage:
'
'       metered
'
'           Show existing profiles
'
'       metered <profile>
'
'           Show metered/non-metered status of <profile>
'
'       metered <profile> ON | OFF
'
'           Set metered status of <profile> to on or off
'
'   Notes:
'
'       The default engine for running scripts is wscript.exe. Before
'       running this script you should set the default engine to cscript.exe
'       (command line - wscript is windowed). Open a command shell as
'       Administrator and enter:
'
'           cscript //nologo //h:cscript //s
'
'       You will only have to do this …
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I was checking out my settings to lead you through the steps when I noticed that the Advanced link on my wi-fi settings was missing. This is where you would go to set/clear the metered option. Lacking this, there is a command line option. Open a command shell and type:

netsh wlan show profiles

On my laptop I see

Profiles on interface Wi-Fi:

Group policy profiles (read only)
---------------------------------
    <None>

User profiles
-------------
    All User Profile     : KenNet
    All User Profile     : mynet-camp
    All User Profile     : mynet
    All User Profile     : ROGERS7608

The profile I am interested in is mynet-camp. For further details type

netsh wlan show profile name="mynet-camp"

On my laptop I see

Profile mynet-camp on interface Wi-Fi:
=======================================================================

Applied: All User Profile

Profile information
-------------------
    Version                : 1
    Type                   : Wireless LAN
    Name                   : mynet-camp
    Control options        :
        Connection mode    : Connect automatically
        Network broadcast  : Connect only if this network is broadcasting
        AutoSwitch         : Do not switch to other networks
        MAC Randomization  : Disabled

Connectivity settings
---------------------
    Number of SSIDs        : 1
    SSID name              : "mynet-camp"
    Network type           : Infrastructure
    Radio type             : [ Any Radio Type ]
    Vendor extension          : Not present

Security settings
-----------------
    Authentication         : WPA2-Personal
    Cipher                 : CCMP
    Authentication         : WPA2-Personal
    Cipher                 : Unknown
    Security key           : Present

Cost settings
-------------
    Cost                   : Fixed
    Congested              : No
    Approaching Data Limit : No
    Over Data Limit        : No
    Roaming                : No
    Cost Source            : User

The area of interest is Cost Settings. You …

rproffitt commented: By your command. *bewoop bewoop. +11
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Here's a simple example.

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        AddRow("Frank", "Bowles", "Parker")
        AddRow("Richard", "James", "Harvey")
        AddRow("Kenneth", "Harry", "Morgan")
    End Sub

    Sub AddRow(ByVal col1, ByVal col2, ByVal col3)
        Dim row As Integer = dgvTest.Rows.Add(1)
        dgvTest.Rows(row).Cells(0).Value = col1
        dgvTest.Rows(row).Cells(1).Value = col2
        dgvTest.Rows(row).Cells(2).Value = col3
    End Sub

    Private Sub dgvTest_CellDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvTest.CellDoubleClick
        If e.ColumnIndex = 2 Then
            frmDetails.txtFirst.Text = dgvTest.Rows(e.RowIndex).Cells(0).Value
            frmDetails.txtMiddle.Text = dgvTest.Rows(e.RowIndex).Cells(1).Value
            frmDetails.txtLast.Text = dgvTest.Rows(e.RowIndex).Cells(2).Value
            frmDetails.Show()
        End If
    End Sub

End Class

dgvTest is a DataGridView with three columns. frmDetails is a separate form with three TextBoxes that are populated when the user double clicks on column 2 (last name) of a row in dgvTest. The new form is displayed non-modal so that the user can see details from other rows without closing the details form.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I have had similar problems and I have found it was easier overall to just rebuild everything from scratch. That means creating a new project while keeping the broken one open. Create a form of the correct size then go to the original form and do "select all/cop", then go to the new project and paste all the controls on the blank form. Do the same copy/paste for the code.

ddanbe commented: That's what I would do too. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Each iteration means the another copy of the function is running until the last one exits.

That's not quite the case as I understand it. There is only one copy of the function. What happens is that with each call, values get pushed onto the stack (and get popped off when each call exits).

rproffitt commented: This is/was covered in the course compiler design years ago. No one takes that course today. +11
rubberman commented: I wrote a fibbonacci computation routine once that used recursive exceptions... :-) That was to test the "new" to C++ exception handling algorithms +14
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

There is only one way to exit from the function and that is by falling through to the end. That will happen once for every call to the function (including recursive calls).

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You might want to use Notepad++ instead of Notepad. It's better, supports regular expressions, and is free. Your search term as a regex is

\(.*$

and your replacement text is blank. In brief "\(" matches a left parenthesis, ".*" matches any length string and "$" matches the end of line. In toto the string matches everything from the first "(" to the end of the line.

cereal commented: +1 +14
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In order to use a ProgressBar you have to know the total number of rows before you start. If you don't know this before you start you will have no way of knowing where you are in the transfer. The following code assumes you have 142 rows. Every time you add a new row you increment the value of the ProgressBar by one. The line with the Sleep is only there to slow things down so you can see the ProgressBar moving.

Dim numRows As Integer = 142

ProgressBar1.Maximum = numRows
ProgressBar1.Value = 0

For i As Integer = 1 To numRows
    ProgressBar1.Value += 1
    System.Threading.Thread.Sleep(50)
Next
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Ah. I see the difference.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

That's odd because what I see is all the posts in all of Daniweb from newest to oldest which is (I think) what you are asking for.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Isn't that what you see when you go to the daniweb home page?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

What do those tags refer to?

I presume those are tag "suggestions" in that if you want to add tags to an existing thread you can just click on those. Yes. It's confusing. The only tags actually associated with a thread are displayed on the thread summary page.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Useful except the OP has this thread tagged with vb.net. Bit operations on bytes can be done easily with

Function SetBit(ByVal byteval As Byte, ByVal bitnum As Byte) As Byte
    Return byteval Or (1 << (7 - bitnum))
End Function

Function ClrBit(ByVal byteval As Byte, ByVal bitnum As Byte) As Byte
    Return byteval And (255 Xor (1 << (7 - bitnum)))
End Function

Function FlipBit(ByVal byteval As Byte, ByVal bitnum As Byte) As Byte
    Return byteval Xor (1 << (7 - bitnum))
End Function

Note that these functions number the bits left to right (MSB to LSB) zero-relative.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Here is some sample code to read the entire contents of a file into a byte array, modify one byte, then write the file back out. This code replaces one byte with another. I'll leave it up to you to determine (from your bit number), which bit of which byte is to be modified. It's pretty simple math.

Dim bytes = My.Computer.FileSystem.ReadAllBytes(TESTFILE)
bytes(4) = Asc("\")
My.Computer.FileSystem.WriteAllBytes(TESTFILE, bytes, False)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

OK. Simple question, simple answer. Do a binary read of the file, modify the bit/byte, then do a binary write of the file. Just make sure you change the extension from mp3 to something else because once you make the file decodable/unplayable it is no longer an mp3 file.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

So use rproffitt's suggestion but encrypt the embedded mp3. Or distribute the encrypted mp3s as separate files and embed the decryption key in your application.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can reference a control dynamically by name like

num = 4
dim tbx as TextBox = Me.Controls("TextBox" & num)

Then you can reference the control through the variable. If you want to cycle through a series of TextBoxes just put it in a look like

For i As Int = 1 To 5
    dim tbx as TextBox = Me.Controls("TextBox" & i)
    tbx.Text = ....
Next
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Except possibly the question "given a choice between a format (mp3) supported by every media player on the planet, and your hypothetical media player which will be the only one to play your special format, why would anyone want to use either your files or your player?"

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you plan to write your own app (wrapper) but don't want to write your own tag code you can use either Perry's IDs Tag Library (which I have used) or this one which I have not tried.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Also, it's a good idea to quote the assignment spec

Could be copyright issues with that. Probably best to paraphrase.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Why bother? There is already a program (diskmgmt.msc) on every version of Windows that already does this. And if you need finer control and more options there is diskpart.exe which is also included.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You could be a victim of the double dot problem. See the note section of this code snippet for details.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If the file isn't encrypted (you did not specify) then they have access to the entire contents. I the file is encrypted but the file name is not then perhaps inferences can be made from the file name.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Once you have done the upgrade to Windows 10 your computer is registered with some sort of digital ID with Microsoft. At that point you can do a clean re-install of Windows 10 and you will be automatically recognized as legitimate.

Robert_43 commented: This is what I'm seeing too. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Sounds an awful lot like a homework assignment. We don't do homework.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

A much simpler solution would be something like

Dim srcFolder As String = "d:\temp\don"
Dim ConcatFile As String = "d:\temp\don\concat.txt"

For Each file As String In My.Computer.FileSystem.GetFiles(srcFolder, FileIO.SearchOption.SearchTopLevelOnly, "file*.txt")
    Dim text As String = System.IO.File.ReadAllText(file)
    System.IO.File.AppendAllText(ConcatFile, text)
Next

Yes, this causes the output file to be opened and closed multiple times, but the simplicity of the code far outweighs the very minor performance hit. Modify it as appropriate for your directory and file structure. The third parameter in GetFiles is a file pattern to restrict the input to files of a specific naming pattern. Use *.* for all files (but then you'll likely have to put the Concat file in a different folder). Another advantage is that AppendAllText will create the ConcatFile if it doesn't already exist.