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 ***