I have to navigate between the records from the dept table.
But when I am tryng to do that I get stuck at teh second record. and teh inc value gets reset to 0. Please let me know an alternative to this. I guess maintaining session state is an option .. but I am not sure of how to do it. Please suggest .
OracleConnection cn = null;
int Rec_Max = 0;
int inc;
DataSet ds = null;
public void Page_Load(object sender, EventArgs e)
{
string cs = "user id=scott;password=tiger";
cn = new OracleConnection(cs);
cn.Open();
// MessageBox.Show("Oracle connection opened sucessfully");
OracleDataAdapter da = null;
OracleCommandBuilder cmb = null;
da = new OracleDataAdapter("select * from dept", cn);
cmb = new OracleCommandBuilder(da);
ds = new DataSet();
da.Fill(ds, "deptx");
Rec_Max = ds.Tables["deptx"].Rows.Count;
NavigateRecords(inc);
cn.Close();
cn.Dispose();
}
public void NavigateRecords(int disp_rec)
{
DataRow dr1 = ds.Tables["deptx"].Rows[inc];
txt_DeptName.Text = dr1.ItemArray.GetValue(0).ToString();
txt_DeptNo.Text = dr1.ItemArray.GetValue(1).ToString();
txt_Location.Text = dr1.ItemArray.GetValue(2).ToString();
}
public void btn_Next_Click(object sender, EventArgs e)
{
{
inc++;
NavigateRecords(inc);
int record_number =inc;
break;
}
}
}