#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Essex, ON
    Posts
    18
    Rep Power
    0

    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'"

    Try
    CN_SDURWARD.RETURN_CONNECTION.Execute(SQL)
    Catch ex As Exception
    MsgBox(ex.Message()) 'In case something goes wrong
    End Try


    and this is the code I use to Load the ID column into the listview


    ListView1.Columns.Add("ID", 40, HorizontalAlignment.Center)


    any suggestions?

    Thanks in advance
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    SC
    Posts
    26
    Rep Power
    0

    Talking I'm going to try!


    ok, I dont' remember exactly my issue, but I do remember this same sorta thing happening to me.

    To reidderate:

    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.

    Good Luck!

    Comments on this post

    • Gran Roguismo agrees

IMN logo majestic logo threadwatch logo seochat tools logo