retrieve data

jtoutou

Active member
Joined
Oct 11, 2008
Messages
26
Programming Experience
Beginner
hello
my first topic
i am creating an application vb.net using sql server 2005 database.
i created a form with textboxes and comboboxes and also the table adapter e.t.c
for the saving the adding data i use the following function
VB.NET:
Private Function Save() As Boolean

    Dim saved As Boolean = False


    If Me.myDataSet.HasChanges Then

        Try
            Dim mytableUpdates() As DataRow = Me.mydataset.mytable.Select("", "", DataViewRowState.Added Or DataViewRowState.ModifiedCurrent)
            'Button1.Visible = True

            Me.myTableAdapter.Update(mytableUpdates)


            saved = True

        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End If


    Return saved

End Function
then when i click the save button
VB.NET:
Private Sub savebtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Me.Validate()
    Me.mytableBindingSource.EndEdit()

    If Me.Save Then
        MsgBox("table Updated Succesfully")
    Else
        MsgBox("Update failed")
    End If

End Sub

then
there is small form which is open when you click
a search com button
here is my problem
i can not find a standard way to search with parameteres for example the lastname
i populate in a combobox all the lastnames .you choose one and then you click ok.
what after that.

VB.NET:
Dim PrsView As DataView = mydatasett.mytable.DefaultView
PrsView.RowStateFilter = DataViewRowState.OriginalRows
PrsView.RowFilter = ComboBox1.Text ([COLOR="Red"]there is a mistake[/COLOR] )
how then i can populate in the form the data in the rest 14 textboxes using lastname
 
Last edited by a moderator:
Read the DNU link in my signature too.. it contains info to help you avoid a problem a lot of newbies fall into
 

Latest posts

Back
Top