| | |
Navigate records thru dataset.
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2008
Posts: 38
Reputation:
Solved Threads: 0
Hello,
Im using ASP.NET as front end and SQL Server as back-end. and i couldnt navigate the records. im not getting correct way. more over im having some doubts in the dataset also. normally im designing the dataset by picking the dataset from "Add New Items" only.
because, if i drag and drop a dataset from the toolbar, i couldnt set its properties correctly. Mainly i cant set the "data Source". So, for each and every table, the dataset named as DataSet1,DataSet2.....Like that. comming to the coding. im also having problem with navigating records. for that im using Session variables.
[ Imports System ]
[ Imports System.Data ]
[ Imports System.Data.SqlClient ]
In Page_Load..
[ Dim con as SqlConnection ]
[ Dim adp as SqlDataAdapter ]
[ Dim data as DataSet2 ]
[ If NotIsPostBack() Then ]
[ con.ConnectionString = "Data Source = ACER;Initial Catalog = Preethi;Integrated Security = True ]
[ con.Open() ]
[ data = New DataSet2 ]
[ adp = New SqlDataAdapter("Select * from emp",con) ]
[ adp.Fill(data,"emp") ]
[ Session("Recno") = 0 ]
[ TextBox1.Text = Data.Tables(0).Rows(0).Item(0) ]
[ Textbox2.Text = Data.Tables(0).Rows(0).Item(1) ]
[ End IF ]
In First Button , im giving..
[ Session("Recno") = 0 ]
[ TextBox1.Text = Data.Tables(0).Rows(Recno).Item(0) ]
[ TextBox2.Text = Data.Tables(0).Rows(Recno).Item(1) ]
In Next Button ,
[ Dim InitRec as Integer ]
[ InitRec = Session("Recno") + 1 ]
[ TextBox1.Text = Data.Tables(0).Rows(InitRec).Item(0) ]
[ TextBox2.Text = Data.Tables(0).Rows(InitRec).Item(0) ]
If i click in Next button, it shows Error, "There is no row at position 1" and " Index Out of Range".
the same for previous, if i give
[ InitRec = Session("Recno") - 1 ]
it will show,
" There is no row at position -1 "
I think , there may be some problem with my dataset. can anyone please enlighten me...
Im using ASP.NET as front end and SQL Server as back-end. and i couldnt navigate the records. im not getting correct way. more over im having some doubts in the dataset also. normally im designing the dataset by picking the dataset from "Add New Items" only.
because, if i drag and drop a dataset from the toolbar, i couldnt set its properties correctly. Mainly i cant set the "data Source". So, for each and every table, the dataset named as DataSet1,DataSet2.....Like that. comming to the coding. im also having problem with navigating records. for that im using Session variables.
[ Imports System ]
[ Imports System.Data ]
[ Imports System.Data.SqlClient ]
In Page_Load..
[ Dim con as SqlConnection ]
[ Dim adp as SqlDataAdapter ]
[ Dim data as DataSet2 ]
[ If NotIsPostBack() Then ]
[ con.ConnectionString = "Data Source = ACER;Initial Catalog = Preethi;Integrated Security = True ]
[ con.Open() ]
[ data = New DataSet2 ]
[ adp = New SqlDataAdapter("Select * from emp",con) ]
[ adp.Fill(data,"emp") ]
[ Session("Recno") = 0 ]
[ TextBox1.Text = Data.Tables(0).Rows(0).Item(0) ]
[ Textbox2.Text = Data.Tables(0).Rows(0).Item(1) ]
[ End IF ]
In First Button , im giving..
[ Session("Recno") = 0 ]
[ TextBox1.Text = Data.Tables(0).Rows(Recno).Item(0) ]
[ TextBox2.Text = Data.Tables(0).Rows(Recno).Item(1) ]
In Next Button ,
[ Dim InitRec as Integer ]
[ InitRec = Session("Recno") + 1 ]
[ TextBox1.Text = Data.Tables(0).Rows(InitRec).Item(0) ]
[ TextBox2.Text = Data.Tables(0).Rows(InitRec).Item(0) ]
If i click in Next button, it shows Error, "There is no row at position 1" and " Index Out of Range".
the same for previous, if i give
[ InitRec = Session("Recno") - 1 ]
it will show,
" There is no row at position -1 "
I think , there may be some problem with my dataset. can anyone please enlighten me...
![]() |
Similar Threads
- Database is not updating but no errors :( (VB.NET)
- Data Navigation in textboxes with ADO.NET (like ADO) (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: SiteMap navigation using asp:Button class
- Next Thread: what is asp.net
| Thread Tools | Search this Thread |
.net activexcontrol advice ajax alltypeofvideos appliances asp asp.net bc30451 beginner bottomasp.net box browser button c# cac checkbox class click commonfunctions control countryselector dataaccesslayer database datagridview datagridviewcheckbox datalist deployment development dgv dialog dropdownlist dynamic dynamically edit embeddingactivexcontrol expose fileuploader fill findcontrol flash formatdecimal formview gridview gudi iframe iis javascript listbox login microsoft mono mouse mssql news novell numerical opera panelmasterpagebuttoncontrols problem radio redirect registration relationaldatabases reportemail save schoolproject search security sessionvariables silverlight smartcard smoobjects software sql sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos vista visualstudio vs2008 web webapplications webdevelopemnt webdevelopment webprogramming webservice wizard xsl youareanotmemberofthedebuggerusers





