Link to home
Start Free TrialLog in
Avatar of jnowlin
jnowlin

asked on

How Challenging is it to Connect, Add, Update, Delete - VB and Oracle

Hello.

I've heard that Visual Basic has some interesting challenges when it comes to dealing with an Oracle database. Connecting to it is not terribly difficult. I was able to do that once.

But, adding records (recordsets) and updating and record deletion........

Is there somewhere where I can some sample code or, even better, a book dedicated to beginner/intermediate Visual Basic/Oracle database handling?
I've done this using PowerBuilder and Oracle. PowerBuilder's data window control with the data window object perform all of the connections and data retrieval very nicely. VB 6 requires coding.

JimNowlin
ASKER CERTIFIED SOLUTION
Avatar of Ktoshni
Ktoshni
Flag of Malta image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Give this a try:

Dim oAdoOracle As ADODB.Connection
Dim oRS As ADODB.Recordset
Dim sSQL as string

sSql = "select * from your_table where product_name = '" & sProdName & "'"
Set oRS = oAdoOracle.Execute(sSql)


sSql = "insert into your_table(product_id, product_sts, product_name, district ) & _
values(" & sProdID & "," & lProdStatus & ",'" & sProdName & "','" & sDistrict & "')"
oAdoOracle.Execute (sSql)


sSql = "update your_table set product_status = " & lProdStatus & " where product_id = " & lProdID
oAdoOracle.Execute (sSql)


sSql = "delete from your_table where product_name = '" & sProdName & "'"
oAdoOracle.Execute sSql


Hope this helps!
Preece
Avatar of jnowlin
jnowlin

ASKER

Preece,
I'm in the process of installing Personal Oracle 8i (again). I'll need some time to try your suggested code, as this install (into Windows2000 Pro this time) has always been difficult for me to do, the documentation's on the CD notwithstanding.

Ktoshni,
I took your advice and bought "Visual Basic Oracle 8 Programmer's Reference" by Dov Trietsch published by Wrox Press. It was a coin toss between a book by Snowdon and Trietsch. I have a number of books by Wrox and I consider them to be one of my best blocks of reference materials.

Jim
Avatar of jnowlin

ASKER

Hi Ktoshni,

I bought "Visual Basic Oracle 8" by Dov Trietsch on Wrox.
He also explains early on that the ADODC control should be used.

I will be posting more questions as I go through the book.

Thank You.

Jim