[RESOLVED] Its Urgent please solve my create table query in vb6
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: [RESOLVED] Its Urgent please solve my create table query in vb6

  1. #1
    Join Date
    Apr 2013
    Posts
    2

    [RESOLVED] Its Urgent please solve my create table query in vb6

    for my project i need to create a table. But name of table given by user in a text box
    I am using Ms Access 2007 database and vb 6.0

    i have written following code but getting error " Error in create table statement "

    Private Sub Command1_Click()
    Dim cn As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Administrator\My Documents\project1.mdb;"
    cn.Open

    Dim id As String
    id = text1.text
    rs.Open "Create table" + id + "(id int)", cn
    rs.close



    I code is running if i write table name instead of variable

    rs.open "Create table abc (id int)",cn

    this code is working

    but i need to create a table by given value

    please help me

    Thanks in advance

  2. #2
    Join Date
    Jul 2005
    Posts
    1,075

    Re: Its Urgent please solve my create table query in vb6

    You should use the connection
    Code:
    cn.Execute ("create table " & text1.text & " (id int)")
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  3. #3
    Join Date
    Apr 2013
    Posts
    2

    Re: Its Urgent please solve my create table query in vb6

    Thanks a lot......

  4. #4
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,594

    Re: [RESOLVED] Its Urgent please solve my create table query in vb6

    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center