this is the code in vb.net for searching when a serial number is given from the sqldatabase.....................

Private Sub s2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s2.Click
        Dim a As Integer
        Dim b As Boolean
        Dim connection As OleDb.OleDbConnection
        Dim command As OleDb.OleDbCommand
        Dim dr As OleDb.OleDbDataReader
        connection = New OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;data source='e:\amit kumar\nic hyd\nichyd.mdb'")
        connection.Open()
        command = New OleDb.OleDbCommand("select *from gate_pass", connection)
        dr = command.ExecuteReader
        b = False
        If (sno2.Text = "") Then
            b = True
            MessageBox.Show("enter the serial number first")
        Else
            Try
                a = Integer.Parse(sno2.Text)
                While dr.Read()
                    If (a = dr(0)) Then
                        Dim bytImage() As Byte
                        bytImage = CType(dr(9), Byte())
                        Dim ms As New System.IO.MemoryStream(bytImage)
                        Dim bmImage As New Bitmap(ms)
                        Form5.r0.Text = dr(0)
                        Form5.r1.Text = dr(1)
                        Form5.r2.Text = dr(2)
                        Form5.r3.Text = dr(3)
                        Form5.r4.Text = dr(4)
                        Form5.r5.Text = dr(5)
                        Form5.r6.Text = dr(6)
                        Form5.r7.Text = dr(7)
                        Form5.r8.Text = dr(8)
                        Form5.picout.Image = bmImage
                        Form5.picout.Refresh()
                        b = True
                        dr.Close()
                        connection.Close()
                        Me.Hide()
                        Form5.Show()
                        Exit While
                    End If
                End While
            Catch ex As FormatException
                Me.ErrorProvider1.SetError(sno2, "please enter a numeric value")
                MessageBox.Show("please enter a numeric value")
                sno2.Focus()
                b = True
            End Try
        End If
        If (b = False) Then
            MessageBox.Show("No data found matching to this serial number")
        End If
        dr.Dispose()
        connection.Dispose()
        dr.Close()
        connection.Close()
        sno2.Text = ""
        Me.ErrorProvider1.Clear()
        
    End Sub

is this one right in asp.net coding also. if there are any changes plz mention it thanking you

And you would need to use a client side alert() instead of MessageBox.Show() . More than likely you don't want to send the user error information though for security reasons so you would want to redirect them to an "Error Page" and log the error in the event log or sql database.

and what about this region

Form5.r0.Text = dr(0)                        Form5.r1.Text = dr(1)                        Form5.r2.Text = dr(2)                        Form5.r3.Text = dr(3)                        Form5.r4.Text = dr(4)                        Form5.r5.Text = dr(5)                        Form5.r6.Text = dr(6)                        Form5.r7.Text = dr(7)                        Form5.r8.Text = dr(8)

its giving an error saying that from5 is not declared
eventhough i created it and names it as form5

As adatapost mentioned, those are windows controls. You will use similar code in ASP.NET to set those values on a web control instead of a win control but it is more or less the same syntax.

plz can you do this favour by mentioning them (web controls)

This article has been dead for over six months. Start a new discussion instead.