0

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
2
Contributors
2
Replies
73
Views
2 Weeks
Discussion Span
Last Post by josh_9
0

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

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.