|
-
Apr 1st, 2003, 08:01 AM
#1
Thread Starter
Sleep mode
Read specific record in database ?[Resolved]
How ?
Thanks for any help !
Last edited by Pirate; Apr 1st, 2003 at 03:57 PM.
-
Apr 1st, 2003, 08:35 AM
#2
Thread Starter
Sleep mode
No databinding at all .
-
Apr 1st, 2003, 09:07 AM
#3
Frenzied Member
What you mean by specific record? I mean how you specify that record?
If you want to read the record number 10, column number 2 for example then one way would be
VB Code:
mydata=myDataset.mytable.Row(9)(1) 'Zero based index
'or
mydata=myDataset.myTable.Rows.Item(9)(1)
If you want to read a record based on a primary key or value of a filed, then that would be another story
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Apr 1st, 2003, 09:32 AM
#4
Thread Starter
Sleep mode
Yes Lunatic3 , I need to show the whole record after I provide some info .Meaning , show all data based on specific given value .
Got it ?
Thank you
-
Apr 1st, 2003, 09:36 AM
#5
That is what a Select SQL statement is for Pirate.
Select * From table Where something = somthing
-
Apr 1st, 2003, 09:41 AM
#6
Thread Starter
Sleep mode
Well , I did tried that . See this...
but I want to show all related fields . How ?
VB Code:
Public Overloads Shared Function speificRec(ByVal colum As String, ByVal SearchText As String, ByVal lstbox As ListBox)
Dim sql As String = "Select C_URL FROM MyTab"
Dim da As New OleDbDataAdapter(sql, MyConnection)
Static ds As DataSet
If ds Is Nothing Then
'if not filled yet fill it
ds = New DataSet()
'fill dataset
OpenDB.OpenDB()
da.Fill(ds, "MyTab")
CloseDB.CloseDB()
da.Dispose()
End If
Try
Dim dv As New DataView(ds.Tables("MyTab"), "" & colum & " Like'" & SearchText & "%'", colum, DataViewRowState.CurrentRows)
lstbox.DataSource = dv
lstbox.DisplayMember = colum
Catch x As Exception
MsgBox(x.Message)
End Try
End Function
End Class
-
Apr 1st, 2003, 09:50 AM
#7
Pirate, you really need to be more clear. I have no clue what you are trying to figure out.
-
Apr 1st, 2003, 09:55 AM
#8
Frenzied Member
you mean all of the values of a specific row?
Then
VB Code:
Dim allvalues as Array
allvalues=myDs.myDatatable.Rows(desiredrowindex).ItemArray
'or for dataviews
allvalues=myDV.Item(desiedrowindex).Row.ItemArray
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Apr 1st, 2003, 09:58 AM
#9
Thread Starter
Sleep mode
yeah yeah Lunatic3 . That's it . So how can I do then ?
Sorry guys if I confused you
-
Apr 1st, 2003, 10:03 AM
#10
Thread Starter
Sleep mode
Originally posted by Lunatic3
you mean all of the values of a specific row?
Then
VB Code:
Dim allvalues as Array
allvalues=myDs.myDatatable.Rows(desiredrowindex).ItemArray
'or for dataviews
allvalues=myDV.Item(desiedrowindex).Row.ItemArray
Sorry Lunatic3 , Do you mean this ? I haven't tried it yet!
-
Apr 1st, 2003, 10:13 AM
#11
Frenzied Member
Yes, then you can play with allvalues array.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Apr 1st, 2003, 10:16 AM
#12
Thread Starter
Sleep mode
Ok , I will give it a shot and tell you what happened .
Thanks Lunatic3 .
-
Apr 1st, 2003, 03:56 PM
#13
Thread Starter
Sleep mode
Lunatic3 , I used another way around to achieve what I need . I customized the SQL Stat. to load all records for specific table and then used datarow object assigned to label or textbox or whatever .
It's solved now .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|