|
-
Nov 19th, 2002, 04:41 AM
#1
Thread Starter
Lively Member
where is movenext ?
hi
How can I navigate throu records of a table?. Is there any Dataset or datareader methods for that?
thanks
when in doubt, win the trick
-
Nov 20th, 2002, 06:01 AM
#2
Thread Starter
Lively Member
when in doubt, win the trick
-
Nov 20th, 2002, 12:35 PM
#3
Sleep mode
Movenext still there ,
after doing this , your bug will be resolved :
1-in the solution explorer of your project , click COM tab and then add reference to Microsoft DAO 3.51 Object Library.
(if you didn't find the file named AO350.DLL then copy it from VB6 CD or any website)
2- declare your variables that store DB and RECORDSET in the general declaration of your Form as follow :
VB Code:
Dim db As DAO.Database
Dim rec As DAO.Recordset
3-your done now !!!
Pirate
-
Nov 20th, 2002, 01:09 PM
#4
You can just travel through the array/collection of datarows in the dataset.
VB Code:
Static cnt as Integer
Msgbox (ds.Tables(0).Rows(cnt).Item(0).Value)
'to move next
cnt+=1
If cnt>ds.Tables(0).Rows.Count then cnt=0
-
Nov 21st, 2002, 12:18 AM
#5
Thread Starter
Lively Member
thanks edneeis,
now I'm using such similar code. But I've to make it sure movnext is not there.
thanks
when in doubt, win the trick
-
Nov 21st, 2002, 09:56 AM
#6
Sleep mode
Originally posted by pirate
Movenext still there ,
after doing this , your bug will be resolved :
1-in the solution explorer of your project , click COM tab and then add reference to Microsoft DAO 3.51 Object Library.
(if you didn't find the file named AO350.DLL then copy it from VB6 CD or any website)
2- declare your variables that store DB and RECORDSET in the general declaration of your Form as follow :
VB Code:
Dim db As DAO.Database
Dim rec As DAO.Recordset
3-your done now !!!
Pirate
did you get the above code worked ??
-
Nov 21st, 2002, 10:35 AM
#7
Addicted Member
Pirate - that code is old. This is VB.NET and DAO is dead. Use DataSets or DataReader to get data back.
Although backwards compatible there is no point in using those techniques. Just my thoughts.
Wind and waves resolves all problems.
-
Nov 21st, 2002, 10:45 AM
#8
Sleep mode
Re: where is movenext ?
Originally posted by afterMoon
hi
How can I navigate throu records of a table?. Is there any Dataset or datareader methods for that?
thanks
OK, listen you told me that you wanted the MOVENEXT method which is only avilable in VB6. That what I know .If you think this method is out of date you should've mentioned which VB method you're looking for.
Just my thoughts.
-
Nov 21st, 2002, 12:15 PM
#9
PowerPoster
He said "Is there any Dataset or datareader methods for that?"
That doesn't mean he literally wants the movenext method. He did post in a VB.Net forum, which means that he wanted a .Net answer.
-
Nov 21st, 2002, 07:21 PM
#10
Sleep mode
hellswraith ,
First , have a look at the title " where is movenext ?" before reading the content .
Second , I've tried this code and it worked in VB.NET , and I am 100% sure
thanx anyway
-
Nov 21st, 2002, 09:13 PM
#11
PowerPoster
Sure it works in .Net, but that isn't the way your supposed to do it. There are much more efficient ways to do it now. Leave COM and VB6 ways behind. Just look at Edneeis's way.
-
Nov 21st, 2002, 10:28 PM
#12
Hyperactive Member
There's about a million different ways of navigating through .NET "resultsets". Here's one way of doing it:
VB Code:
Imports System
Imports System.Data
Imports System.Data.SqlClient
Namespace DataNavigation
Module MainApp
Public Sub Main()
Dim connString As String = "user id=sa;password=sa;database=pubs;server=manson;"
Dim cn As SqlConnection = New SqlConnection(connString)
Dim cmdText As String = "Select * From Authors"
Dim cmd As SqlCommand = New SqlCommand(cmdText, cn)
Dim ds As DataSet = New DataSet("Authors")
Dim da As SqlDataAdapter
Dim dtable As DataTable
Dim drow As DataRow
Dim dcol As DataColumn
da = New SqlDataAdapter(cmd)
da.Fill(ds)
dtable = ds.Tables(0)
For Each drow In dtable.Rows
For Each dcol In dtable.Columns
Console.Write(drow(dcol.ColumnName).ToString())
Console.Write(",")
Next
Console.WriteLine()
Next
Console.ReadLine()
End Sub
End Module
End Namespace
-
Nov 21st, 2002, 10:54 PM
#13
Sleep mode
Originally posted by hellswraith
Sure it works in .Net, but that isn't the way your supposed to do it. There are much more efficient ways to do it now. Leave COM and VB6 ways behind. Just look at Edneeis's way.
I think a user has the choice to use VB6 ways,as you said,as long as it's still supported in .NET.He asked about that specific method "movenext movenext movenext........."!!!
Tip of the Day!
MS will never support old and inefficient ways in .NET,so COMs is welcomed to work out.
-
Nov 22nd, 2002, 01:42 AM
#14
Thread Starter
Lively Member
Order! Order!
I 've chosen Edneeis way!. I searched for a VB.NET method, not a DAO method. I used the word 'MOVENEXT' just for better communication.
Anyway Thanks to all.
when in doubt, win the trick
-
Nov 22nd, 2002, 03:16 AM
#15
Addicted Member
Of course MS will support old inefficent ways, they are a large company who know their developers. Why alienate 3 million developers of vb6 by offering no backwards compatability??? VB.NET is a large, very good (in my opinion),step forward but it is once again a progression in the language. If you want a completely new language then look to C#. Anyway just my thoughts!
Wind and waves resolves all problems.
-
Nov 22nd, 2002, 11:34 AM
#16
PowerPoster
pirate,
Don't get so upset, I was just saying that you need to read beyond the title sometimes. COM interop is great when it is needed, but in this case, it isn't needed. There is to much overhead using COM components in .Net. Always try to find a .Net way to do it before going with COM.
-
Nov 22nd, 2002, 07:32 PM
#17
Sleep mode
afterMoon , you got to be more precise & specific posting your thread. OK ???
alright hellswraith ,you got what I was trying to say .
hey cim3 , no need to talk about MS and C# coz you will open an unend-cirlce , moreover , all what you've said was nothing to do with this post.
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
|