如何可以在vb輪入資料到oracle???

2007-05-28 2:02 am
如何可以在vb輪入資料到oracle???
我想將data由vb輸入到 oracle, 我想用vb把data入到customer, 但不知怎樣做, 希望有人可以解答到我, thx
我的oracle table如下:
CREATE Table Customer (Customer_id Varchar2(5) constraint pk_customer PRIMARY KEY,
Customer_name VarChar2(50) NOT NULL,
Age NUMBER (2),
Address VarChar2(60),
Tel_no NUMBER(8),
Gender VarChar2(1) CHECK (Gender in ('M','F')));

回答 (1)

2007-05-29 1:01 pm
✔ 最佳答案
If you are an Oracle user, I assume you are quite advanced and know how to work with ActiveX Data Object (ADO).

1. Download Oracle Provider for OLE DB of your version from here
http://www.oracle.com/technology/software/tech/windows/odpnet/utilsoft.html

2. Install the downloaded file on the machine running the VB program.

3. The downloaded file will give you the utility to set up the name that points to the Oracle server.

4. In VB project, add ADO 2.x library to Reference

5. Use these lines to open a connection to Oracle

Dim conn As New ADODB.Connection
ConnectString = "Provider=OraOLEDB.Oracle;User ID=database_user_id;Password=user_password;Data Source=server_pointer;"
conn.Open ConnectString

6. Use these codes to update the table

sql = " INSERT INTO Customer ( .... ) "
conn.Execute sql

sql = " UPDATE Customer SET Age=30 WHERE Customer_id='ming' "
conn.Execute sql

7. Finally close the connection
conn.Close
Set conn = Nothing


收錄日期: 2021-04-25 20:34:11
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20070527000051KK03850

檢視 Wayback Machine 備份