Protected Sub btnFirst_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnFirst.Click Dim i As Long = 0 Dim str1 As String = "SELECT Min(IT_CODE_ACT) FROM PS_EXT_MAST " conn.Open() Dim cmd1 As SqlCommand = New SqlCommand(str1, conn) Dim dr As SqlDataReader = cmd1.ExecuteReader() dr.Read() If dr.HasRows Then txtItemCode.Text = dr(0).ToString() i = Convert.ToInt32(txtItemCode.Text) End If conn.Close() Dim str2 As String = "select IT_DESC from PS_EXT_MAST where IT_CODE_ACT= " + i conn.Open() Dim cmd2 As SqlCommand = New SqlCommand(str2, conn) Dim dr2 As SqlDataReader = cmd2.ExecuteReader() dr2.Read() If dr2.HasRows Then txtItemDesc.Text = dr2(0).ToString() End If conn.Close() Response.Write("<Script>alert(' First record found....')</Script>") End Sub Protected Sub btnLast_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnLast.Click Dim i As Long = 0 Dim str1 As String = "SELECT Max(IT_CODE_ACT) FROM PS_EXT_MAST" conn.Open() Dim cmd1 As SqlCommand = New SqlCommand(str1, conn) Dim dr As SqlDataReader = cmd1.ExecuteReader() dr.Read() If dr.HasRows Then txtItemCode.Text = dr(0).ToString() i = Convert.ToInt32(txtItemCode.Text) End If conn.Close() Dim str2 As String = "select IT_DESC from PS_EXT_MAST where IT_CODE_ACT=" + i conn.Open() Dim cmd2 As SqlCommand = New SqlCommand(str2, conn) Dim dr2 As SqlDataReader = cmd2.ExecuteReader() dr2.Read() If dr2.HasRows Then txtItemDesc.Text = dr2(0).ToString() End If conn.Close() Response.Write("<Script>alert(' Last record found....')</Script>") End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)