473,427 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,427 software developers and data experts.

MoveFirst, MoveLast

Hello!

I use data.read and data.getValue(Id_column) to get the value of
specified column. Unfortunately there are some differences between
VBScript and Visual Basic (MS Access) and I cannot move to the first and
last record of data. I searched archieves and I couldn`t find any
example how to do it. I use MS SQL Server 2000 as a server and I wrote a
sql query where I used data.reader. Could you give me the example how to
modify the code to have movefirst and movelast possibilites?

Thank you in advance
Marcin

*** Sent via Developersdex http://www.developersdex.com ***

Nov 19 '05 #1
1 3135
you can't use a datareader to do that, as it's a forward only data
construct. If you wish to navigate, use the dataset. You'll need to give it
a dataview, and then do a check on the rows, and read the individual row i.e
Dim cnNorthwind As SqlConnection = new SqlConnection("Persist
Security Info=False;Integrated
Security=SSPI;database=northwind;server=mySQLServe r")
' Create a SqlDataAdapter for the Suppliers table.
Dim adpSuppliers As SqlDataAdapter = new SqlDataAdapter()
' A table mapping tells the adapter what to call the table.
adpSuppliers.TableMappings.Add("Table", "Suppliers")
cnNorthwind.Open()
Dim cmdSuppliers As SqlCommand = _
new SqlCommand("SELECT * FROM Suppliers", cnNorthwind)
cmdSuppliers.CommandType = CommandType.Text

adpSuppliers.SelectCommand = cmdSuppliers

ds = New DataSet("Customers")
adpSuppliers.Fill(ds)
dim myDataview as dataview=new dataview(ds.tables("suppliers"))
'optionally use mydataview.sort to sort i.e. mydataview.sort="supplierID"
dim intLast as integer=myDataView.count-1
'movelast
console.write (myDataView(intLast)("somecolumn").tostring
'movefirst
console.write (myDataView(0)("somecolumn").tostring

"Marcin Zmyslowski" <ma*****@kapy.bydg.pl> wrote in message
news:ug**************@TK2MSFTNGP12.phx.gbl...
Hello!

I use data.read and data.getValue(Id_column) to get the value of
specified column. Unfortunately there are some differences between
VBScript and Visual Basic (MS Access) and I cannot move to the first and
last record of data. I searched archieves and I couldn`t find any
example how to do it. I use MS SQL Server 2000 as a server and I wrote a
sql query where I used data.reader. Could you give me the example how to
modify the code to have movefirst and movelast possibilites?

Thank you in advance
Marcin

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: shank | last post by:
Can anyone give me some general ideas on why an error like Object doesn't support this property or method: 'ZoneRS.MoveFirst' comes up on a page? MoveFirst is a command to move to the first...
1
by: joeandtel | last post by:
Whenever I use the function moveLast() I get an error that states, "Rowset does not support fetching backward"
3
by: Duncan | last post by:
Hi, I have been passed a class to work with, but am having some problems. I do not know the origin of the code, and am having problems with some functionality. The VB class implements...
3
by: MLH | last post by:
The error occurred in line #5130. Ideas as to why? qryITSLetterList returns 1 single record - but I don't think that should be a problem. Hmmm??? 5100 Dim MyDB As Database, rstITSLttrs As...
7
by: MLH | last post by:
Here's a blurb cut from A97 HELP on BOF/EOF: When you open a Recordset object that contains at least one record, the first record is the current record and the BOF and EOF properties are False;...
2
by: le0 | last post by:
Hello guys, I have this little problem in query, i queried one table and sort this record in descending order but when I declared the recordset to move in the last record but the browser rerurns...
1
by: klaydze | last post by:
i have here my lines of codes. how can i use the RECORDSET.MOVELAST in VB.NET. because i need to use the rs.movelast so that my pointer will go to the last record in my database. this line of code...
2
by: rudeman76 | last post by:
Hey, I am having a problem when i try to edit or use the movelast in a recordset. What i am trying to do is that when a user starts, they enter in a password on a password form. From here (in...
4
by: MLH | last post by:
160 Dim DB As Database, Rst As Recordset, QD As QueryDef 170 Set DB = CurrentDb() 180 Set QD = DB.CreateQueryDef("", MySQL) 190 Set Rst = QD.OpenRecordset(dbOpenDynaset) HOW TO COUNT RECORDS IN...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.