dcsimg
Results 1 to 2 of 2

Thread: Problem adding data to oracle database in vb6

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2018
    Posts
    17

    Lightbulb Problem adding data to oracle database in vb6

    Hello friends
    I have a problem adding data oracle database,it's show me this message(" https://ufile.io/lzpuj ") Run-time ORA-00904:"EMPCODE": invalid identifier.
    This is Cody:
    Name:  Untitled.png
Views: 108
Size:  5.2 KB
    Code:
    Dim connEmp As ADODB.Connection
    Dim rsEmp As ADODB.Recordset
    
    Private Sub Command1_Click()
    Set rsEmp = New ADODB.Recordset
     rsEmp.Open "select * from tablebooks where empcode = '" & Text1.Text & "'", connEmp, adOpenKeyset, adLockReadOnly, adCmdText
     If rsEmp.RecordCount <> 0 Then
     MsgBox " ! هذا الكتاب موجود بالفعل "
     rsEmp.Close
     Set rsEmp = Nothing
     Exit Sub
     Else
     Set rsEmp = New ADODB.Recordset
     rsEmp.Open "select * from tablebooks where empcode = '" & Text1.Text & "'", connEmp, adOpenKeyset, adLockPessimistic, adCmdText
     rsEmp.AddNew
     
     rsEmp!Book_no = Val(Trim(Text1.Text))
     rsEmp!Book_name = Trim(Text2.Text)
     rsEmp!Author_name = Trim(Text10.Text)
     rsEmp!Edition_no = Val(Trim(Text3.Text))
     rsEmp!Publisher_place = Trim(Text11.Text)
     rsEmp!Part_no = Val(Trim(Text5.Text))
     rsEmp!Book_cost = Trim(Text6.Text)
     rsEmp!Place_book = Trim(Text7.Text)
     rsEmp!Note = Trim(Text9.Text)
    
     rsEmp!Date_publishing = DTPicker1.Value
     rsEmp!Subject = Trim(Combo4.Text)
     rsEmp!State = Trim(Combo4.Text)
     rsEmp.Update
     connEmp.Execute "commit"
     rsEmp.Close
     Set rsEmp = Nothing
     Label11.Visible = True
     Label11 = " ! تمت الإضافة بنجاح "
     End If
    End Sub

  2. #2
    Lively Member
    Join Date
    Jan 2018
    Posts
    65

    Re: Problem adding data to oracle database in vb6

    Most likely empcode isn't an existing column, are you sure the column isn't emp_code or something? I presume it's failing on the second line.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width