Hi, I m new member of 'daniweb' i m a student of BCA 5 in india i m intrested in VB,Oracle,JAVA,Networking so Please help me....

I m creating a project like mobile company! i have problem to create table in ORACLE 9i using VB6. I have some problem to give condition to create table the condition is as follows

IF table is created on Oracle DB then table remain as it is, But if it is not created on DB it will created autometically. So how can i give condition?

Please help me my frends to solve this problem.
Please send me some example of VB code so i can understand it.

Recommended Answers

All 4 Replies

Please pass more information. What do you mean by table will be created automatically. You can check if the table exists in database or not by using simple SQl statments.

Yes u r right I need to Check Weather The table exist on Database Or not If the table not exist on database It will create autometically by VB6 by simple SQL statement.

I don't know How can i give condition for chacking table exist or not.


thanks for Replaying. Please send Code of the it.

Hi,

Use On Error Resume next:

Dim sSQL As String
On Error Resume Next
sSQL = "Create Table EMP(ENo Number(10,0), EName Varchar2(50))"
Conn.Execute sSQL

Or,
Check for the table name in "TAB" Collection..

Dim sSQL As String
Dim RST As New ADODB.Recordset
sSQL = "Select * From Tab Where TName='EMP'"
RST.Open sSQL,Conn
If RST.EOF Then
    'Table Not Found, So Create..
    sSQL = "Create Table EMP(ENo Number(10,0), EName Varchar2(50))"
    Conn.Execute sSQL
End If

REgards
Veena

Thenks Brother.
It's very helpful!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.