I've read through the tutorial regarding Listviews and SQL's (http://www.daniweb.com/software-development/vbnet/code/445801/avoiding-sql-injection-attacks). Thanks for the article. It was very imformative.
So I thought I might try this with the project I'm doing. I really like how these listview look and what they can do. But I realize I need to know more and understand it better. So.... my first question:
The code in the example reads:
cmd.CommandText = "SELECT au_lname,au_fname,phone " _ & " FROM authors " _ & " WHERE au_lname like @lastName " _ & " AND phone like @phone " _ & " ORDER BY au_lname "
It appears to me that what you are doing here is two things: 1) you are creating your search criteria and, 2) you are defining to "au_last" to named "@lastName" and the "phone (number) to be named "@phone". I am also presuming you want the list to order it alphabetically by last name. Can you confirm that my assumptions are true? If not, I need more clarification.
Now the second question: What does these lines of code do?
cmd.Parameters.AddWithValue("@lastName", txtLastName.Text) cmd.Parameters.AddWithValue("@phone ", txtPhone.Text)
Some of you may have responded to some questions about populating data within a DataGridView. Having now seen how the listview looks, I really like it much better..... and it seems you can do more with it.
I look forward to the answers. I'd like to try to use these snippets as code within the project I'm working.
Thanks for all each of you do!