Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

In VB.NET there are methods FindFirst if yes as them to use

Status
Not open for further replies.

prischenkoOOO

Programmer
Apr 6, 2005
5
UA

Excuse for English.
My code:
'''''''''''''''''''''''''''''''''''''''''''''''''''''' '
Dim strConn As String
Dim strSQL As String
strConn = " Provider=Microsoft. Jet. OLEDB.4.0; Data Source=E:\Klient __.mdb "
dinamicDB = New OleDb. OleDbConnection (strConn)
DBAdapter = New OleDb. OleDbDataAdapter
strSQL = " SELECT * FROM Klient "
DBAdapter. SelectCommand = New OleDb. OleDbCommand (strSQL, dinamicDB)
dinamicDB.Open ()
Dim DS As DataSet
DS = New DataSet
DBAdapter. Fill (DS, "Klient")
Dim dr As DataRow
Dim Col As DataColumn

For x = 0 To DS.Tables ("Klient") .Rows () .Count - 1
Col = DS.Tables ("Klient") .Columns (1) ' a name of the client
dr = Col. Table. Rows (x)
st = dr. ItemArray (1)
Grid.set_TextMatrix (x + 1, 1, st)
Col = DS.Tables ("Klient") .Columns (0)
dr = Col. Table. Rows (x)
st = dr. ItemArray (0)
Grid.set_TextMatrix (x + 1, 4, st) ' id the client
Next
'''''''''''''''''''''''''''''''''''''''''''''''''''''' '
I need to click the mouse on a line 'Grid', to receive 'id' and then the half-scientist 'id' to find DS.Tables ("Klient")
In VB.6 I used RecordSet. FindFirst

It is thankful in advance
Thanks.
 
You're trying to find the row in the table that matches a selected id?
Code:
'myid is the id selected from the grid
Dim myId As Integer = 1234
Dim rows As DataRow()
'Find Matching Row(s)
rows = ds.Tables("Klient").Select("id=" + myId.ToString)
'Go to the first row (and probably only row)!
Dim dr As DataRow = rows(0)


Sweep
...if it works dont mess with it
 
Yes I need to find in the table a line corresponding id
I shall try now your example
 
Many thanks, works.
I from Ukraine badly know English thought you of me will not understand.
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top