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
Solved

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

Posted on 2001-08-07
4
254 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…

766 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