-
Help! to create a table with dynamically assigned name from VB 6.0
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
-
Does your variable contain any illegal characters?
-
Not sure if this thread has been resolved, but the solution is "SYNTAX INCORRECT!"
The following worked fine for me. Check out quotes.
Cn.Execute ("create table " + vtblNametxt + " (id varchar2(3),pname varchar2(20), qtyp number(4));")
-
A minor point. The + sign should only be used when added numbers together. If you are using string concantenation, the & sign should be used.
Code:
Cn.Execute ("create table " & vtblNametxt & " (id varchar2(3),pname varchar2(20), qtyp number(4));")
Similar Threads
-
By Chris in forum Database
Replies: 3
Last Post: 08-20-2002, 12:14 AM
-
Replies: 1
Last Post: 05-07-2002, 10:32 AM
-
By Thomas Eyde in forum .NET
Replies: 290
Last Post: 12-22-2001, 03:13 PM
-
Replies: 1
Last Post: 11-27-2001, 07:53 AM
-
By Michael Kascher in forum VB Classic
Replies: 2
Last Post: 05-31-2000, 02:48 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|