Results 1 to 2 of 2

Thread: listbox or datagridview

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2009
    Posts
    9

    listbox or datagridview

    Hi,

    i'm doing a desktop application using VS2005 with MSSQL 2005.

    i have a problem with the where clause in the update statement while selecting the listbox item.


    this is the code for the listbox in load page:
    Code:
     Dim cmdView As New SqlCommand("select * from Appointment where contactID = '" & cID & "' and recordStatus = 'active'", conn)
                lbApp.Items.Clear()
    
                Dim dr As SqlDataReader
                dr = cmdView.ExecuteReader()
    
                While dr.Read
    
                    Dim a As String
                    Dim b As String
                    Dim c As String
                    Dim d As String
                    Dim f As String
                    Dim g As String
    
                    a = dr("time")
                    b = dr("actStatus")
                    c = dr("meetingPlace")
                    d = dr("note")
                    f = "    "
                    g = a + f + b + f + c + f + d
    
                    lbApp.Items.Add(g)
    
                End While
    
                dr.Close()
                conn.Close()

    and this is my update query in the delete button event handler:
    Code:
    mySQL = "update Appointment set recordStatus = 'deleted'"
    how do i put in the where clause in when i have 4 columns in the listbox?
    so can i do this with listbox or have to do with datagridview?

    I'd appreciate any input, thanks!
    Last edited by showai; May 12th, 2009 at 04:47 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width