now i got the solution for my rollno generation query..
Code:Dim rs As New ADODB.Recordset If Combo1.Text = "BE-CSE" Then strSQL = "Select Count(*) From biodata where dept=' " & Combo1.Text & " ' " rs.Open strSQL, cn, adOpenKeyset, adLockReadOnly, adCmdText If Not rs.BOF And Not rs.EOF Then rno = "10cs" & rs.Fields(0).Value + 1 End If rs.Close Set rs = Nothing ElseIf Combo1.Text = "BE-AERO" Then strSQL = "Select Count(*) From biodata where dept=' " & Combo1.Text & " ' " rs.Open strSQL, cn, adOpenKeyset, adLockReadOnly, adCmdText If Not rs.BOF And Not rs.EOF Then rno = "10AE" & rs.Fields(0).Value + 1 End If rs.Close Set rs = Nothing![]()




Reply With Quote