Insert and delete records in to oracle table using visual basic 6
Posted on 2008-10-31
Hi I have managed to connect to oracle and retrieve records using the following coding.
Private Sub cmdPayments_Click()
If cmboClient.ListIndex = -1 Then
MsgBox ("Please select client name to continue")
Dim oconn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strSQL As String
strSQL = "SELECT * FROM PAYMENTS WHERE CPNY_NAME = " & "'" & cmboClient.Text & "' ORDER BY PAYMENT_DATE "
Set oconn = New ADODB.Connection
oconn.Open "Provider=msdaora;Data Source=xxx;User Id=xxx;Password=xxxx;"
rs.CursorType = adOpenStatic
rs.CursorLocation = adUseClient
rs.LockType = adLockOptimistic
rs.Open strSQL, oconn, , , adCmdText
Set DataGrid1.DataSource = rs
DataGrid1.Enabled = True
I am stuck and am unable to insert records or delete records. Can you help provide coding for this please.
I want to insert/delete in to table PAYMENTS
The fields are CPNY_NAME (TEXT), DESCRIPTION (TEXT), PAYMENT_DATE (DATE), DEBIT (NUMBER), CREDIT (NUMBER)
I have 5 objects which I want to type in the data and then insert from them.
- cmboClient (combo box)
- txtDescription (text box)
- txtPaymentDate (textbox)
- txtDebit (textbox)
- txtCredit (text box)
I have a form to insert and another form to delete with same ojects as above. However in delete form shold show the records which you can go through and delete.
Please advise if you need more info. Thanks alot experts.