Thursday, November 11, 2010

How to delete insert and update records with vb as front end and oracle as back end?

I need to do a simple banking project with vb as front end and oracle as back end.

I need to delete, inset and update records in oracle via vb.

code or references will help!!How to delete insert and update records with vb as front end and oracle as back end?
First you need to create an ODBC connection to the oracle database. You will need to have oracle client installed on your PC for this (basic install). You can do this in the ';Start-%26gt;Control Panel-%26gt;Administrative Tools-%26gt;Data Sources (ODBC)'; Make sure you specify a username and password that has add/delete privilages in the database.



Then you can use this ODBC definition in a connection in you vb program.



Your code will look something like this.

Dim conn as String

Dim cn As ADODB.Connection

conn = ';DSN=YourDSN;UID=myUID;PWD=myPass;'; _

' %26amp; ';SERVER=ORASERVER;';

'';DRIVER={Microsoft ODBC for Oracle};'; _



Set cn = New ADODB.Connection



With cn

.ConnectionString = conn

.CursorLocation = adUseClient

.Open



End With





Now the connection can be used to create a recordset that can be used to add/modify/delete records. The connection can also be used to execute SQL statements to update, insert or delete records.

No comments:

Post a Comment