Start New Discussion within our Software Development Community

Hi friends
I need some help from VB and Oracle guru's.
I am trying to create a dynamic table from VB 6.0 in Oracle (mean I want to create a table whose name is dynamic issue)
For this purpose I code as follow and get error table name is not valid:-

1. Draw a Text Box on form with name tblNametxt
2. Draw a button on form with name cratblebtn
3. Variable Declaration

Dim Cn as ADODB.Connection
               Dim Conn as String
               Dim vtblNametxt as String

4. Established a successful connection between VB 6.0 and Oracle 8i.
5. Code for button

vtblNametxt= tblNametxt.txt
Cn.Execute(“create table ‘ ” + vtblNametxt + ” ’ (id varchar2(3), pname varchar2(20), qtyp number(4))”)

on click at button in running mode I got an error :Table name is invalid

I repeat point 5 as

vtblNametxt= tblNametxt.txt
Cn.Execute(“create table ”  & vtblNametxt & ” (id varchar2(3), pname varchar2(20), qtyp number(4))”)

But again I got an error :Table name is invalid

I again repeat as fixed name as

vtblNametxt= tblNametxt.txt
Cn.Execute(“create table sman(id varchar2(3), pname varchar2(20), qtyp number(4))”)

Then this code is run successfully.

Kindly help to create a table with dynamically assigned name from VB 6.0.

Thanks in advance

hi,


Store the whole query in string variable and execute.

SQL = ("create table "  & vtblNametxt & " (id varchar2(3), pname varchar2(20), qtyp number(4))")
cn.Execute(SQL)

Shailaja

This article has been dead for over six months. Start a new discussion instead.