September 28th, 2003, 11:44 AM
making a listview column of Integer type
Here's my diffculty. I have a fully functional listview except for one thing. I have written a remove button click event but I get the following error.
Error message is:
Syntax error converting the vchar value 'ID' to a column of data type int
In my SQL database, I have the Field ID set as Integer and as my unique.
This is the code i am using for the click event
SQL = "DELETE FROM ttimeoff WHERE ID = 'ID'"
Catch ex As Exception
MsgBox(ex.Message()) 'In case something goes wrong
and this is the code I use to Load the ID column into the listview
ListView1.Columns.Add("ID", 40, HorizontalAlignment.Center)
Thanks in advance
September 30th, 2003, 04:02 PM
I'm going to try!
ok, I dont' remember exactly my issue, but I do remember this same sorta thing happening to me.
You have a list bound control, and you want to delete the selected item?
First off, you have to look closely at the attributes of you listcontrol. The data for it is actually set up like an ARRAY. So you have to find the "SelectedITEM" first. If you are using VS.NET, you can see in the drop down that there are like 3 items used for SELECTEDITEM. Do a display of each item to a label control, so you can see the value of each. Then you can be sure you are not only populating it correctly, but you can see what is being returned as well. If I remember correctly, it's a bit confusing until you actually print out the results, then you will understand the issue.
My guess, is you are just not getting the ID you think you are.
Comments on this post