| | |
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 2.0 3.5 activexcontrol advice ajax appliances asp asp.net beginner bottomasp.net box browser businesslogiclayer button c# c#gridviewcolumn cac checkbox child class click compatible confirmationcodegeneration content contenttype control countryselector courier css database datagrid datagridview datalist deadlock deployment development dgv dialog dropdownmenu dynamic edit embeddingactivexcontrol feedback fileuploader fill findcontrol flash flv form forms gridview gudi homeedition hosting iframe iis javascript jquery list menu mono mssql multistepregistration nameisnotdeclared novell objects order problem ratings redirect registration relationaldatabases rotatepage search security select serializesmo.table sessionvariables silverlight smartcard sql ssl tracking treeview typeof validatedate validation vb.net virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopment wizard xml xsl





