Solved

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

Posted on 2001-08-07
4
251 Views
Last Modified: 2010-05-02
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
0
Comment
Question by:jnowlin
  • 2
4 Comments
 

Accepted Solution

by:
Ktoshni earned 75 total points
ID: 6362745
I have used Vb with Oracle and it's not that bad. I would suggest however that when you need to do updates, inserts or deletes that you use the ADODB command object. This will allow you to prepare normal Oracle SQL commands. Also, I prefer to avoid data aware controls as they cause more problems than they do solve them. It's better to make a number fo functions or routines which you can reuse in different projects. As far as books goes I suggest seeing what's avalable at Amazon.com - I've found plenty of good VB books there and you can trust the ratings they give. Hope this helps
0
 
LVL 12

Expert Comment

by:Preece
ID: 6365176
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
0
 

Author Comment

by:jnowlin
ID: 6378045
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
0
 

Author Comment

by:jnowlin
ID: 6411569
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
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now