Hi,
Im using ASP.NET as front end and SQL SERVER as backend. i navigate the records in this using session variables. but its not working.
Imports System
Imports System.Data
Imports System.Data.SqlClient
After Inherits im writing
Dim con as SqlConnection
Dim com as SqlCommand
Dim adp as SqlDataAdapter
Dim data as DataSet
In Page_Load,
con = New SqlConnection
con.ConnectionString = "Data Source = ACER;Initial Catalog = Preethi;Inetgrated Security = True
If Not IsPostBack() Then
adp = New SqlDataAdapter("select * from emp",con)
data = New DataSet
adp.Fill(data)
TextBox1.Text = data.Tables(0).Rows(0).Item(0)
TextBox1.Text = data.Tables(0).Rows(0).Item(1)
TextBox1.Text = data.Tables(0).Rows(0).Item(2)
TextBox1.Text = data.Tables(0).Rows(0).Item(3)
con.Open()
Session("Recno") = 0
End If
Im having 4 Textbox and 1 dropdownlist box in webform.
In DropDownList1 , doing all opeartions for database connection, and im writing the following text
Session("Recno") = DropDownList1.SelectedValue.
DropDowlList1.DataSource = data
DropDownList1.DataTextField = "EmpName"
DropDownList1.DataValueField = "EmpNo"
DropDownList1.DataBind()
I also Placed 4 buttons for NAvigation ,
In Button 1 - First
Session("Recno") = 0
PreviousButton.Enabled = False
In Next Button,
Session("Recno") = +1
IF Session("Recno") = data.Tables(0).Rows.Count - 1 Then
NextButton.Enabled = false
MsgBox("Last Record")
But with this code it is not working , webpage remains same, not moving to next record.
And same for Previous also, it doesnt work.
For Previous Button im giving Session("Recno") = -1
For LAst Button, Session("Recno") = data.Tables(0).Rows.Count - 1
So the Records i cant navigate, can any one help me solve this problem????????
(for the past 6 months im searching, but im not getting the correct solution.)