how to insert data field in a table is empty
Posted
by banita
on Stack Overflow
See other posts from Stack Overflow
or by banita
Published on 2010-03-25T09:45:00Z
Indexed on
2010/03/25
9:53 UTC
Read the original article
Hit count: 501
Hi iam making an application in vb as front end and backend as oracle . I want autogenerated id on click of new button.it works well if data is present in table but show error if the table is empty . What i need to insert so that it work when iam first time using the appliction . my button code is as
Private Sub cmd_new_Click()
Call txt_clear
txt_name.Enabled = True
Set rsCat = New ADODB.Recordset
rsCat.Open "Category", conn, adOpenDynamic, adLockPessimistic
If rsCat.EOF = rscat.BOF Then
tempId = 1000
Else
rsCat.MoveLast
tempId = rsCat.Fields("Category_Id") + 1
End If
txt_Id = tempId
cmd_Save.Enabled = True
cmd_new = False
End Sub
© Stack Overflow or respective owner