Solved

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

Posted on 2001-08-07
4
256 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

691 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