dbconn.Open()

    s = "Select Max(cheque_no) + 1 As NewValue From tblEntry"
    Dim cmd As SqlCommand = New SqlCommand(s, dbconn)
    Dim dr As SqlDataReader = cmd.ExecuteReader()

    If dr.HasRows Then
        dr.Read()
        If IsDBNull(dr("NewValue")) Then
            empId = 1
        Else
            empId = CInt(dr("NewValue")) + 1
        End If
    Else
        empId = 1
    End If
    dr.Close()

    Me.TextBox1.Text = empId

reverend Jim thanks for the respond :) but i get it.. thank you a lot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.