DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Help! to create a table with dynamically assigned name from VB 6.0

  1. #1
    Join Date
    Jul 2008
    Posts
    1

    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

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Does your variable contain any illegal characters?

  3. #3
    Join Date
    Mar 2008
    Posts
    61
    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));")

  4. #4
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    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

  1. Replies: 3
    Last Post: 08-20-2002, 12:14 AM
  2. Replies: 1
    Last Post: 05-07-2002, 10:32 AM
  3. They created J#, why couldn't they do VB#?
    By Thomas Eyde in forum .NET
    Replies: 290
    Last Post: 12-22-2001, 03:13 PM
  4. Getting a GUI to function
    By Eric in forum Java
    Replies: 1
    Last Post: 11-27-2001, 07:53 AM
  5. How do you create a file system object in vb srcipt or vb 6.0
    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center