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