Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Progressive Search
 

Progressive Search

Hi all,

i am working on a project whereby i am required to insert, update and delete of customer details in a database. I am using a textbox to do a progressive search on the handphone numbers inside the database whereby if the handphone number exists inside the database, it will display the customer details in the textboxes i have created. Handphone number is a column in my database table. After i delete the specific row of the table, the handphone number of the deleted row still existsin the textbox, i have tried the clear method to empty the source and using a fill method to retrieve the data again but its not working, here are the codes:

Any help would be deeply appreciated,
Charles

Dim nameCommand As SqlCommand = conn.CreateCommand()

                    nameCommand.CommandText = _

                   "DELETE FROM CustDetail WHERE RmuNum = '" & txtSearch.Text & "'"



                    nameCommand.ExecuteNonQuery()



                    da.Fill(ds, "CustDetail")



                    Me.txtSearch.AutoCompleteCustomSource.Clear()



                    Me.txtSearch.AutoCompleteMode = AutoCompleteMode.Suggest

                    'The data source is filled programmatically. 

                    Me.txtSearch.AutoCompleteSource = AutoCompleteSource.CustomSource

                    'Create the custom source. 

                    Me.txtSearch.AutoCompleteCustomSource = New AutoCompleteStringCollection()

                    'Get the DataTable. 

                    dt = ds.Tables("CustDetail")

                    'The column we want to help the input. 

                    Const suggestColumnIndex As Integer = 3

                    'Traverse the rows and and the suggest values. 

                    For Each row As DataRow In dt.Rows

                        Me.txtSearch.AutoCompleteCustomSource.Add(row(suggestColumnIndex).ToString())

                    Next



                    MsgBox("Client data Deleted")


Charles Mohd  Wednesday, September 16, 2009 5:06 PM
What of this is not working? You are still getting the deleted row?

Are you creating a new dataadapter somewhere else? Where is it getting the data adapter from for the fill?
www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
DeborahK  Thursday, September 17, 2009 12:18 AM
Hi,
i am still getting the phone number of the deleted row inside the textbox but the row is already deleted. The dataadapter was created at the beginning to fill the dataset with the data.
Charles Mohd  Thursday, September 17, 2009 1:19 AM
Is the Textbox bound to the datatable? Can you post the code for that?

www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
DeborahK  Thursday, September 17, 2009 1:26 AM
Hi,
i don't think so. But if it is its only like this :
        dt = ds.Tables("CustDetail")
        'The column we want to help the input. 
        Const suggestColumnIndex As Integer = 3
        'Traverse the rows and and the suggest values. 
        For Each row As DataRow In dt.Rows
            Me.txtSearch.AutoCompleteCustomSource.Add(row(suggestColumnIndex).ToString())
        Next
Charles Mohd  Thursday, September 17, 2009 3:19 AM
How about just this:

txtSearch.Text = string.empty

www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
DeborahK  Thursday, September 17, 2009 3:40 AM
nope, still the same.
Charles Mohd  Thursday, September 17, 2009 3:59 AM

You can use google to search for other answers

Custom Search

More Threads

• DataGridViewComboBoxColumn will initially display the ValueMember rather than DisplayMember
• How to wrap a row in the DataGridView?
• Databindings and BackgroundWorker component
• datagridview resetting
• selected value of DataGrid
• Problem with databinding?
• Getting Strongly Typed DataSets
• Framework for binding multiple tables to single datagrid
• DataGridView: How to get rid of old DataTable.Colum
• Can I have a blank row in datagrid without binding it to datasource?