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

Funny how all of the countries on that list have universal (socialized) healthcare.

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

US is probably 20

And how to you arrive at 20?

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

And it's not that much extra typing to do

DirectCast(sender,TextBox).SelectAll()
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The path and filename is just a string and if you don't know how to insert a string value into a database then you have put exactly zero effort into learning. Any beginning database programming book will show you how to do this in the first chapter or two.

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

As a newbie, the first thing you should learn is how to use SEARCH. As Philippe pointed out, your question has been asked and answered several times. You would have found this out had you put in even a minimal effort to look instead of just asking someone else to do the work for you.

TnTinMN commented: :) +6
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I learned that one in the SPEBSQSA.

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

How far down that list is the US?

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

I never throw out code so no harm done.

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

Circling back to the very first post in this thread, some time ago scientific testing debunked the claim that a duck's quack doesn't echo. It does.

The term HumVee is an attempt to pronounce the military designation of HMMWV which stands for Highly Mobile Motorized Wheeled Vehicle.

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

The problem is that the people with the most ridiculous ideas are always the people who are most certain of them. —Bill Maher

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

I changed the category back to code snippet so that it could be found more easily (separate from regular threads). I put the code back into the code snippet window but now there is something screwy with the formatting. The tabs, which while in edit mode are the correct four spaces, change to eight spaces after I click Save.

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

I'm an old timer as well with grandparents from Holland. Welcome aboard.

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

Diafol pointed out that when you changed the category to tutorial, all of the code got deleted. When I put the code back in the Tutorial status was cleared.

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

And now that the code is back in the Tutorial flag has been cleared. Oh dear.

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

What you are missing is somehow my large block of code got deleted when it was converted from a code snippet to a tutorial. I put it back in. Thanks for the heads up.

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

Thanks, Davey.

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

So the categories are still there on request. That's good to know.

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

I am used to seeing the categories such as Tutorials, Interviews, Code Snippets, etc at the top of the thread lists. I recently posted some code in the VB.NET forum showing how to used parameterized queries to avoid SQL injection. I wanted to categorize it as a tutorial but my only choices were Discussion Thread or Code Snippet. If these categories are still available then how does one access them? If not then should they be removed from the banner?

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

I didn't know that RichTextBox has .Save and .Load features

Neither did I when I first started using it. That's why I like to browse the intellisense methods from time to time. If this gives you what you need then please mark this thread solved.

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

A lot of questions in the VB.NET forum are database related. Most of the code that gets posted result in one or more comments like "use parameterized queries to avoid SQL injection attacks". I won't describe the nature of a SQL injection because it is easily looked up via google. There is a lengthy article at Wikipedia. What I will do here is give two examples of how to create queries using parameters. The first example uses SQLDB and the second uses OLEDB. The major difference between the two is that SQLDB uses named parameters while OLEDB uses positional parameters.

With SQLDB you give parameters names. Any name will do but it only makes sense to use a name that relates to the type of parameter. For example, if the corresponding database field is LastName you might name the parameter @lastName or @lname (all parameters must start with "@"). When you add the parameter values you can add them in any order and the @name you use must match the @name in the query string.

With OLEDB you specify a parameter with "?". When you add the parameters you must add them in the same order in which they appear in the query. The parameter names you use can have any name. This can lead to confusion as it might lead you to believe order doesn't matter. It is for this reason I much prefer SQLDB.

Another advantage to using parameterized queries is it avoids awkward syntax when …

Ashenvale commented: Thank you so much for giving me this great tutorial :) CHEERS! +2
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

As tinstaafl says, you didn't say what line was throwing the error. Also, you should never (never) build queries by concatenation. That leads you open to SQL injection attacks. Build your queries using parameters. In your case that looks like

strsql = "UPDATE tbl_tec_temp                 " _
       & "   SET tem_we_position = @position, " _
       & "       tem_we_company  = @company,  " _
       & "       tem_we_salary   = @salary,   " _
       & "       tem_we_date     = @date,     " _
       & "       tem_we_rl       = @rl,       " _
       & "       tem_we_attach   = @attach    " _
       & " WHERE temp_no = @no"

Dim cmd As New SqlCommand(strsql)
cmd.Parameters.AddWithValue("@position", TextBox8.Text)     
cmd.Parameters.AddWithValue("@company ", TextBox10.Text)
cmd.Parameters.AddWithValue("@salary  ", TextBox21.Text)
cmd.Parameters.AddWithValue("@date    ", DateTimePicker1.Text)
cmd.Parameters.AddWithValue("@rl      ", TextBox22.Text)
cmd.Parameters.AddWithValue("@attach  ", TextBox36.Text)
cmd.Parameters.AddWithValue("@no      ", TextBox39.Text)

Please note the formatting of the statement that builds the query. Spreading the query across multiple lines makes it easier to read and adding a few blanks as padding to line fields up makes it easier to spot typos.

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

Please post the code you are using to load and save the text. The usual way to load and save rich text is as follows:

Private Sub btnSave_Click(sender As System.Object, e As System.EventArgs) Handles btnSave.Click
    RichTextBox1.SaveFile("d:\temp\myfile.rtf")
End Sub

Private Sub btnLoad_Click(sender As System.Object, e As System.EventArgs) Handles btnLoad.Click
    RichTextBox1.LoadFile("d:\temp\myfile.rtf")
End Sub
DyO152 commented: Use this if you want to save/load from/on RichTextBox +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In that case

TextBox1.Text = ""

Dim con As New SqlConnection("Server=.\SQLEXPRESS;Database=mydb;Trusted_Connection=yes;")
Dim cmd As New SqlCommand

con.Open()

cmd.Connection = con
cmd.CommandText = "select count(*) as count,Name from supplies group by Name order by count desc"

Dim rdr As SqlDataReader = cmd.ExecuteReader

Do While rdr.Read() And ListView1.Items.Count < 3
    TextBox1.Text &= rdr("Name") & " "
Loop

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

We appreciate your willingness to contribute but please check the dates on posts before you respond to them This thread is more than two years old and it is likely that the original poster (OP) no longer needs help with this issue. Reviving this thread pushes more recent threads further down the list. If you continue to revive old threads you may be hit with an infraction.

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

Please try again. I have no idea what you are asking.

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

For the following code you need to create ListView1 in details view with two columns. It will add up to three rows to the listview with the most frequent items appearing first.

ListView1.Items.Clear()

Dim con As New SqlConnection("Server=.\SQLEXPRESS;Database=mydb;Trusted_Connection=yes;")
Dim cmd As New SqlCommand

con.Open()

cmd.Connection = con
cmd.CommandText = "select count(*) as count,Name from supplies group by Name order by count desc"

Dim rdr As SqlDataReader = cmd.ExecuteReader

Do While rdr.Read() And ListView1.Items.Count < 3
    ListView1.Items.Add(New ListViewItem({rdr("count"), rdr("Name")}))
Loop

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

with Jack Elam and Lee Van Cleef

Quite a while back someone recommended "Once Upon a Time in the West". Beautiful cinematography but possibly the most boring movie ever made. Everyone walked vvveeerrrryyyy sssllloooowwwwlllllyyy. However, there is a scene at the beginning with Jack Elam waiting at the train station. There is a confrontation between him and a fly that is absolutely classic.

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

I'm personally not interested and I don't qualify in any case, but if you want to attract interest I suggest you provide some details as to the type of project, time commitment, timeline, scope, required skillsets, etc.

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

On the following table

Supplies
  ID
  Name

Containing the following rows

1   paper
2   book
3   book
4   book
5   pen
6   pencil
7   pencil
8   pen

The following query

select count(*) as count,Name from supplies group by Name order by count desc

returns

3   book
2   pen
2   pencil
1   paper

Then you can pick the three most frequent items from most to least frequent by stepping through the returned recordset until you have three items or you run out of records.

Begginnerdev commented: Nice +7
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

There is an example of background threads here in this forum.

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

A lot of code and little information. For example, what line of code generates the error? Put a try/catch around it and MsgBox the number of elements and the offending index. The index can't be larger than one less than the number of elements.

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

Welcome back. I see you are in Waterloo. Are you (or were you) associated with the university at all? I have a few friends there on the faculty of Comp Sci.

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

Do not hijack threads, especially old ones. Please check the dates on posts before you respond to them This thread is more than four years old and it is likely that the original poster (OP) no longer needs help with this issue. Reviving this thread pushes more recent threads further down the list. If you continue to revive old threads you may be hit with an infraction.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
  1. Don't hijack threads
  2. Don't resurrect old threads
  3. Show some effort before you post
  4. Provide some details
TnTinMN commented: You should make this post into a keyboard macro. You could use it a lot around here. +6
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

We appreciate your willingness to contribute but please check the dates on posts before you respond to them This thread is more than three years old and it is likely that the original poster (OP) no longer needs help with this issue. Reviving this thread pushes more recent threads further down the list. If you continue to revive old threads you may be hit with an infraction.

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

Fiscal cliff, my a$$.

The government kept everyone in fear following WWII with the "Red Menace". The cold war provided the threat to keep the patriotic fires stoked. This allowed HUAC to proceed with a modern version of the Salem witch trials. When the Soviet Union collapsed they needed a new threat. We got it with the "War Against Terrorism". That gave the government carte blanche to pass all kinds of otherwise unconstitutional laws under the guise of the Patriot Act. Now the powers that be can do warrentless wiretaps and detain people indefinitely. So you have lost the right to privacy and due process. But to totally gut the financial system they needed a different kind of threat so they created the fiscal cliff and kept moving the deadline a few weeks at a time. With financial armageddon always right around the corner all kinds of bad legislation is going to be passed. Say goodbye to social security.

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

We have a friend who likes to go on about the coming apocalypse. In 2011 it was all about the Book of Revelation. Last year it was all 2012. I finally found a way to shut her up. Last year I asked her if she was convinced the world would end in December of 2012. She said "yes". So I asked her if she would sign a contract whereby she would sell me her house for $10,000 as long as I agreed to sell it back for the same price in January of 2013. She refused. I told her it was a no lose deal. She could take that end-of-the-world cruise and not have to worry about paying for it. She still refused. Didn't hear anything more about it after that.

The reason the Mayan calendar ended when it did is the same reason our calendar ends on December 31.

<M/> commented: Nice :) +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Same thing for Patrick (Give me liberty or give me death) Henry.

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

making it a "personal choice" to eat them or not is really just an invitation to make it yet another stupid new-age trend completely detached from reality

Are you saying that when I make a personal decision whether or not to use a product I am being stupid? In the case of new age nonsense like astrology, aroma therapy, crystal power and the healing power of copper bracelets and magnets (all of which have been thoroughly debunked) I agree. To rely on treatments which have been proven to have no benefit is stupid. When it comes to the unknown long term effects of GM foods on our health, the environment and bio-diversity (none of which are known), I resent my choosing to eschew them being labeled as stupid. That's not a reasonable rebuttal. That's just an ad hominem attack. I'm not saying GM foods should be banned. I'm saying I have the right to know so that I can make an informed choice.

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

In the early 1920s, a citizens' group proposed legislation requiring

  • permits to carry concealed weapons
  • increased prison sentences for crimes involving guns
  • citizenship as a requirement to own a handgun
  • a waiting period between buying a gun and receiving it
  • gun dealers to provide police with details of all gun sales

That group was the National Rifle Association.

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

What's a floppy?

Seriously, you can try FFSJ. It's free.

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

If you need a driver then you should tell us

  • what computer
  • what device
  • what operating system
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

On this day in 1924 in Chicago the first all-white Dalmation was spotted.

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

people first began dying from diabetes in 1930s

They probably died of diabetes before this but just couldn't identify the cause.

<M/> commented: probably, my numbers could be wrong +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I don't have my dev machine so I can't test this but I believe the format for a date value is like

select * from tble where Invoiced > #01/05/2012#

so try

    "SELECT * FROM invoiced_filter " & _
    " WHERE Invoiced > #" & fromdte & "# AND < #" & todte & "#"
TnTinMN commented: correct on date format +6
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

But before they voted against the aid package, they voted against extending tax breaks for working Americans and voted to spend more money for lawyers to defend discrimination against gay people by lobbying for the Defense of Marriage Act.

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

I am offended by #3 on that list.

diafol commented: ha ha +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In the aftermath of Hurricane Sandy, 67 House Republicans voted against a relief package to provide aid for storm victims whose houses were flooded, wind-whipped or burned to the ground.

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

Both your tables have a field named ID, but in the Employee table it is the Employee ID and in the Employer table it is the Employer ID. Each record in the Employee table has to be associated with an employer. You do this by ensuring that each record contains the Employer ID.