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

Your problem is likely in your connection string. Sample ADO code for SQL Server is

ListView1.Items.Clear()

Dim con As New ADODB.Connection
Dim rec As New ADODB.Recordset

con.Open("Driver={SQL Server};Server=.\SQLEXPRESS;Database=PUBS;Trusted_Connection=yes;")
rec.Open("SELECT au_lname,au_fname,zip FROM authors WHERE au_lname like 'S%'", con, CursorTypeEnum.adOpenStatic)

Do Until rec.EOF
    ListView1.Items.Add(New ListViewItem({rec("au_lname").Value, rec("au_fname").Value, rec("zip").Value}))
    rec.MoveNext()
Loop

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

I have already wrecked it three times and it hasn't been a year yet.

So you don't take care of your things. Your parents must be so proud.

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

Gotta be cheesecake. I know it's bad for me but that wasn't the question.

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

Perhaps OP should be writing item.Text as in

hisWrite.WriteLine(item.Text)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I thought the winters were too severe for them

It only seems colder because we measure in Celsius ^_^

Farmers raise cattle, like parents raise their children.

Remember, they had to listen to years of Clinton talking about "growing the economy".

I'm reminded of a story my dad once told about a vegetable farmer. He had three sons who always wanted to be in the cattle business because they felt that raising meat was more manly than raising potatoes so when the old man died, they converted the farm from vegetables to cattle. All big ranches have names so they decided to name theirs "Focus" because that's where the sons raise meat.

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

Beef is not grown in Canada? Are you freaking kidding me? Have you had your head in a bucket for the last 20 years?

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

If you post the code we can have a look. Please identify which line is throwing the error.

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

Have a look at this code snippet for examples.

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

When you consider the conditions under which the vast majority of humanity lives I consider myself very fortunate to be living the life I was given. If I were to be reincarnated, the odds of my ending up in an unendurable (compared to my current situation) life are almost guaranteed. I'd just as soon not take the chance.

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

or be reincarnated with my current memory

Not me. Too much baggage.

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

More than all the oceans. There isn't enough water in the world to account for the flood. And have you considered that if you emptied the oceans to flood the land, the water would just run back in? But, again, we are getting off topic. And there's not really much point in arguing with someone who refuses to let those pesky facts get in the way.

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

I had a read and responded on the site with the comment

I think the more likely explanation is an error in translation. The average lifespan in Egypt 3,000 years ago was 35 years. 40 and over was considered old. Less elsewhere. If you take 969 as the number of months that Methuselah lived rather than the number of years then that would have made him about 80 which, while not as impressive as 969 years is still remarkable for that time and certainly worthy of recording.

ddanbe commented: Exellent comment I should say. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

And, BTW, that was only 10,000 years ago.

Or possibly even last Thursday. It's just as probable as 10,000 years and there's just as much proof.

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

I downloaded the project, loaded it into Visual Studio 2010 and did a build. Then I opened explorer and used Open With on temp.xxx (a text file) and set Advanced Notepad.exe in the bin\debug project folder as the default app. Now when I double click on test.xxx your application runs and loads text.xxx just like it is supposed to. As far as I can tell it is doing what you want it to do.

Deep Modi commented: thanks for testing and support from you +1
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

he said he had a Ph.D. in everything.

Of course, it will take him the rest of his 1000 years to pay off his student debt.

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

Coincidentally, my older son is doing his post-doc at Stony Brook University (Long Island) and his area of research is aging. He's plugged in to all the latest research (and experts) in the field. He recently attended a conference in Italy and there is nothing major on the horizon yet. Telomerase looked promising but that seems to be a dead end for now.

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

you might get eaten by a big bird of some sort.

Romney was right in threatening to get rid of Big Bird. I always though BB had a secret agenda.

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

We know the technique works, however, it doesn't work with your code so the obvious next step is for you to post the code. Can you zip and upload the project folder?

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

How is it less expensive to have no insurance?

If you are going to respond then please respond to the comment in context. My point was that having no insurance is only cheaper if you don't get sick or injured (as you point out later on). The same thing for fire insurance on your house. It's only cheaper to have no insurance until your house burns down. Then you are pretty much screwed.

You mean the lie that people who like their present insurance won't have to change it?

I agree. That was a lie. But when you compare lies on both sides then that one is pretty tame. Especially since there was no way to know that the insurance companies would respond by cancelling policies. Obama also said that you could keep your doctor. Obviously that is not true if your doctor refuses to treat you or if he (or she) dies. That's not any where near the scale of "government death panels".

I saw a news item today that said someone was offering a free application similar to LOIC (low orbit ion cannon) to anyone who wanted to launch a DOS attack on the ACA websites. Like Republican controlled states that wanted to make it illegal for your family doctor to even make you aware of the ACA, this just reeks of desperation. Again - if the ACA is so bad then just present people with the facts and let them decide. Instead, the …

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

You stated

To buy booze, street drugs, and other things that are not covered under SNAP.

and

Because there is a list of items that people can get. If it's not on the list, then it can't be bought with SNAP (or WIC).

So you first state that they are using SNAP to buy items that are not covered under SNAP, then you state that they can't buy items that are not on the list.

I think everyone is just scared of unknown future.

It would help if those opposed to it would give valid reasons instead of just making shit up. It's one thing for the public to speculate in a vacuum, but they aren't. The public is being flooded with lies from Republicans and the media who should be giving truthful information. I'll ask again - if the ACA is so awful (worse than slavery if you believe the rhetoric) then why is it necessary for the opponents to spread lies?

It might just be less expensive not to get any insurance and pay the small penalty tax.

How is it less expensive to have no insurance? It's only less expensive if you never need medical care. The number one cause of bankruptcy in the US is medical expenses. Let's say you have equity in a house and you get into a bad accident, or have a heart attack or stroke requiring extended care, possibly surgery. Kiss your equity goodbye. …

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

Instead of trying to get your application to work, create a new project with my controls and code and see if it works. At least you will have proof of concept and we can look elsewhere for the cause.

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

I was unable to follow the video because most of the actions were too fast. Did you browse to the folder containing your application and select the executable? I created a form with one multi-line textbox and the code

Public Class Form1

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        Dim filename As String = My.Application.CommandLineArgs(0)
        TextBox1.Text = System.IO.File.ReadAllText(filename)

    End Sub

End Class

I created a text file with the extension xxx and set my app as the default by browsing to the exe. I double click on test.xxx and it runs my app and opens the file.

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

Right click on a txt file and select Open With in the pop-up menu, then Choose default program. From there select your application (browse to it) and make sure Always use the selected program... is checked.

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

Yes, because it doesn't work due to too many people abusing the system

Republicans want to defund SNAP but they aren't proposing anything to take its place to help the people that need it. In effect they will cut off everyone in order to prevent abuses. I notice they increased agricultural subsidies. I guess there are no corporations abusing the system. I give as much credence to their claims of SNAP abuse as I do to their claims of voter fraud (the reality is essentially non-existent as opposed to their claims of "rampant")

What makes you think they already receive health care?

Reread my post. I didn't say they already received health care. I asked why they wanted to keep millions of Americans from receiving affordable health care.

One father said of TV just this morning that it will cost him at least another $500.00 per month

I see Sean Hannity had three married couples on to talk about how the ACA was going to hurt them. One couple claimed how it would hurt their construction business. They would have to restrict the hours of employees to keep them as part time because of the increased costs. They have only four employees and under the ACA, their only requirement is to make employees aware of the ACA website. There is no cost to do that so they are either lying or ignorant.

The second couple was paying $1100 a month for a policy under …

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

The $500 hammer thing I can understand for two reasons

  1. it's a way of giving yet more money to private companies in return for generous campaign donations
  2. it's a way of hiding expenses for "off book" operations

AD - you are obviously opposed to the ACA. Can you explain to me how Republicans can claim to be pro-life and yet are willing to

  1. defund SNAP
  2. keep millions of Americans from receiving affordable, basic health care
  3. loosen gun laws so that even more people die

And lest I forget, many Republicans would deny contraception (which would prevent unwanted pregnancies) to many. I guess pro-life means only from conception until birth. After that you are on your own.

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

Is this a wireless mouse? I've been having problems for over a year on my 5-year old Dell Inspiron laptop, mostly when I restore from hibernation; almost never when I restore from sleep mode. I've had this happen with two wireless mice and it seems to happen more frequently on the rear ports than the side ports. I even rebuilt the OS from scratch to see if it was a software problem. I suspect it is a hardware problem but it is not serious enough to warrant getting anything fixed. The only thing that works is to remove and reinsert the USB adaptor.

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

That was supplied as the second parameter in the declaration

Dim cmd As New OleDbCommand("", con)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm not sure about a couple of things. First, I don't know why you have the single quotes arount @NEW in

CMD3.Parameters.Add(New OleDbParameter("'@NEW'", OleDbType.Date)).Value = Date.Today

I'm also confused as to why you don't get an error by putting "@" type parameters in the query. On my system (vb.net 2010) I get the error

Must declare the scalar variable "@name".

where I put @name in the query string. This is how I would build the query using OleDb

Dim CMD3 As New OleDbCommand("UPDATE ST SET CLICK = ? WHERE [DATE]= ?",con)

CMD3.Parameters.AddWithValue("@parm1", Label1.Text)
CMD3.Parameters.AddWithValue("@parm2", Today)

where each replaceable parameter is indicated by ? and parameters must be added in the order in which they appear in the query. So try that and let me know how it goes.

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

You have to open the connection before you read. Here's an example

lvwResults.Items.Clear()

Dim con As New OleDbConnection("Provider=SQLNCLI10;Server=.\SQLEXPRESS;Database=PUBS;Trusted_Connection=Yes;Connect Timeout=15;")
Dim cmd As New OleDbCommand("", con)

cmd.CommandText = "SELECT au_lname,au_fname,phone " _
                & "  FROM authors                 " _
                & " WHERE au_lname like ?         " _
                & "   AND phone    like ?         " _
                & " ORDER BY au_lname             "

cmd.Parameters.AddWithValue("@lastName", txtLastName.Text)
cmd.Parameters.AddWithValue("@phone   ", txtPhone.Text)

con.Open()
Dim rdr As OleDbDataReader = cmd.ExecuteReader()

Do While rdr.Read
    lvwResults.Items.Add(New ListViewItem({rdr("au_lname"), rdr("au_fname"), rdr("phone")}))
Loop

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

You can try a test post if you like. Create a new thread and submit the first post. then go to that post and click Edit Post. You should be able to modify the title.

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

many of the prostate surgeries in the USA are unnecessary - the cancer would have gone away by itself

The reason is not that prostate cancer "goes away". The reason is that in many cases the cancer is so slow growing that the sufferer would usually die of other causes before the cancer becomes a problem. In many cases, treatment causes more problems than it solves, impotence and incontinence, for example.

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

My point was that there are conditions that are exclusive to both sexes. Aside from prostate problems, I imagine you rarely see women being treated for erectile disfunction. The insurance $$ all go into the pot for both sexes. Some goes for women's problems and some for men's and some goes for both. And has been said here and elsewhere, reproduction involves both sexes even if the more labor intensive (hilarious pun intended) parts belong to the women.

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

You can only change the title of a thread that you started, and only in the first 30 minutes after you created it if I am not mistaken.

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

Conversely, male-specific benefits was 0.

So prostate examinations and treatment for various disorders of same (enlargement, cancer, etc) apply equally to both sexes?

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

Both of my children are long since out of school and earning an income. Even though I have no further use for the public school system I still gladly pay school taxes because they help pay for a system which benefits society as a whole. Some might consider this a subsidy of a service for which they receive no benefit. I consider it an resposibility for being part of a civilized society. Likewise for that portion of my taxes that go toward maternity care.

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

When you get a response back that says 0 rows affected it means that no records were updated. Try

SELECT * FROM mysql.user  
 WHERE User='garrett' 
   AND Host='localhost';

and see if any records are returned.

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

Works fine for me with Windows 7 Pro and Chrome Version 30.0.1599.101 m

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

The last time I visited emergency room it cost medicare about $1,800.00 just for me to walk in the doors.

Mostly because a great deal of that cost goes into somebody's pocket as profit. That's why a hip replacement in the US costs about $60,000 while in Belgium it's just under $14,000.

That's not just a claim, it is a fact. It was brought up publically several times during the government shutdown and debate about obamacare.

Just because it was brought up does not make it true. From Politifact.com...

Even a few sitting lawmakers have repeated this claim, but it’s not true. Congress is not exempt from Obamacare. Like everyone else, lawmakers are required to have health insurance. They’re also required to buy insurance through the marketplaces. The idea is to have lawmakers and their staff buy insurance the same way their uninsured constituents would so they understand what their constituents have to deal with. Most Americans who already get insurance through work are left alone under the law; members of Congress have insurance through work but are treated differently in this regard. Recently, a rule was added so that lawmakers’ could keep the traditional employer contribution to their coverage. But they weren’t exempt from requirements that other Americans face. We rated this claim False.

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

$634M is just a drop in the bucket compared to what it's going to cost for Obamacare.

Time will tell. Remember that it's the opponents of the Affordable Care Act who are crying about how much it will cost. Let's look at some of the other claims they are making.

  • If You Sign Up For ObamaCare Hackers Will Steal Your Life Savings
  • The health care law rations care, like systems in Canada and Great Britain.
  • The health care law has "death panels."
  • Muslims are exempt from the health care law.
  • The IRS is going to be in charge of a huge national database on health care that will include Americans’ personal, intimate, most close-to-the-vest-secrets.
  • Congress is exempt from Obamacare.
  • The health care law is a government takeover of health care.
  • All non-US citizens, illegal or not, will be provided with free health care services.
  • Under Obamacare, 75 percent of small businesses now say they are going to be forced to either fire workers or cut their hours.
  • At age 76 when you most need it, you are not eligible for cancer treatment under the health law.
  • The health care law includes a 3.8% sales tax on all real estate transactions.
  • "Obamacare is . . . the largest tax increase in the history of the world."
  • A hidden provision in the health care law taxes sporting goods as medical devices.
  • Obamacare will question your sex life.
  • An Obamacare provision will allow forced home inspections …
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If it does I've never bothered to use it. Because I use MS SQL I just installed the best tool for managing it (which was free). Certainly SQL Management Studio is far better than anything you are likely to get built-in to vb in Visual Studio (if anything).

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

How about Chr(e.KeyCode)

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

Also private contractor who is able to subcontract all the actual work offshore.

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

I suggest you download MS SQL Express and SQL Management Studio (both are free). The first is the DBMS (database management system) and the second is the graphical interface for managing the databases (creating, modifying, etc.)

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

If, for example, you wanted to store a value with the key you would do something like

Dim word As String = "cow"
Dim def As String = "a four legged herbivore"

dic.Add(word,def)

Then you can display the value as

MsgBox(dic(word))

You can use different types for key and value by modifying the declaration. For example, you could have an integer key and a string array as the value by

Dim dic As New Dictionary(Of Integer, String())

You could also declare your own object (class) and use that as the value.

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

Even faster, store your dictionary in an actual dictionary as follows

Public Class Form1

    Private dic As New Dictionary(Of String, String)

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        For Each line As String In System.IO.File.ReadAllLines(filename)
            dic.Add(line, "")
        Next
    End Sub

The load time is extremely small and to check if a word is in the dictionary you just do

If dic.ContainsKey(word)

No actual searching (on your part) has to be done. One caution - when I tried this with your wordlist I found a duplicate word (animate). A dictionary takes two entries, a key and a value. In this case you don't need to supply a value; you are only interested in the key. Keep in mind that you'll probably want to do

If dic.ContainsKey(word.ToLower())

because the keys are case sensitive.

robert.knighton.79 commented: Answered my question AND helped fix my dictionary file! Thanks! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can read the entire file by

Dim allLines() As String = System.IO.File.ReadAllLines(filename)
Dim alltext As String = System.IO.File.ReadAllText(filename)

The first line reads the file into an array (one line per entry) while the second reads the entire file into one string (embedded vbCrLf), which is apparently what you were trying to do with the loop. You can get the array from the text as well by

Dim allLines() As String = alltext.Split(vbCrLf)

I suggest you take a little more care naming your variables. strFileName is highly misleading as it does not contain a file name. It contains the file contents. If you sort your dictionary file (it is not sorted based on your example) then you can use a binary search once you have read the file into the array. If you leave it unsorted then you have to do a linear search which is much slower.

robert.knighton.79 commented: Excellent! Worked like a charm! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

We also try to educate, as you might have noticed from the code snippet and tutorial portions of the forums.

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

Run the command shell (cmd.exe) as Administrator then delete the file from there.

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

Same format with different column names. I don't know which column, or combination of columns you would need to narrow the delete down to just one record. Apparently your database does not have a primary key. I base this on the observation that you have a record with no values, and a primary key must have a value. Assuming IQAMA contains a unique value you would do

DELETE FROM yourtablename
 WHERE IQAMA = 1231231232

if IQAMA is a numeric field or

DELETE FROM yourtablename
 WHERE IQAMA = '1231231232'

is a string. Just replace yourtablename with the actual name of the table.

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

I'm not clear on whether your problem is with VB or SQL so I'll just give you the syntax for a SQL delete.

DELETE FROM tablename 
 WHERE condition

Let's say you have a table named Accounts and you want to delete the account for the person whose last name is "Flintstone" and first name is "Fred" (even though it's more likely you would delete by account number in case you have two people with the same name)

DELETE FROM Accounts
 WHERE LastName  = 'Flintstone'
   AND FirstName = 'Fred'