|
-
Apr 3rd, 2004, 07:39 AM
#5
PowerPoster
Hi,
"How can I allow navigation from one record to another, as well as record changes just the way we do in VB6.0 using the Recordset object? I couldn't see any way of doing it. Which object(s) in the Dataset namespace can I use? "
I'll stick to this part of your posting - I'm not sure I quite understand your first part
Assuming your are accessing a single table on an Access database:
In the general section of your form;
Dim cn1 as New Oledb.OledbConnection
Dim da1 as New Oledb.OledbDataAdapter
Dim cb1 as New Oledb.OledbCommandBuilder
Dim dt1 as New DataTable
Dim iRowPosition as Integer=0
Dim rw1 as DataRow
Dim iCount as Integer
In the form Load event:
cn1.ConnectionString="Provider=Microsoft.Jet.oledb.4.0;Data Source=pathto database
cn1.Open
da1=New Oledb.OledbDataAdapter("Select * from tablename",cn1)
cb1= New Oledb.OledbCommandBuilder(da1)
da1.Fill(dt1)
You can now navigate through the DataTable using
rw1.Rows(iCount)
e.g. txt1.text=dt1.Rows((iCount)("FieldName").ToString()
Se how you get on with that (As I have spent so much time at tennis and on the internet, I now have to do penance in the garden)
EDIT: If you are familiar with Imports then you can cut down on the use of "Oledb"
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
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
|