-
April 11th, 2013, 02:41 PM
#1
[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
-
April 11th, 2013, 06:25 PM
#2
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 ...
-
April 12th, 2013, 12:16 PM
#3
Re: Its Urgent please solve my create table query in vb6
-
April 30th, 2013, 09:59 PM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|