: hi
: in my project i want tables to be created automatically during runtime
: for each user who are all creating new id
:
Hi,
do you think that starting new thread for the same question is a good idea?
Are you absolutely sure that you need table for every user?
2 key column table does not solve your problem?
Let's say
...you need to create table with name User_Table_X where X is ID of your current user that needs to create own table.
...table has 2 columns (ID INT NOT NULL PRIMARY KEY IDENTITY(1, 1) and Value VARCHAR(255))
Private Sub CreateUserTable(ByVal id_User As Integer)
Dim sqlConn As New SqlConnection("Place your SQL Connection String HERE")
Dim cCreTab As New SqlCommand("CREATE TABLE User_Table_" & id_User & " (" & _
"ID INT NOT NULL PRIMARY KEY IDENTITY(1, 1), " & _
"Value VARCHAR(255) NOT NULL DEFAULT(''))", sqlConn)
sqlConn.Open()
Try
cCreTab.ExecuteNonQuery()
Finally
sqlConn.Close() 'XXX
End Try
End SubXXX - allways make sure that you close your connections, even if error occurs
(You can also use Using statement for accomplish this Try-Finally block)
After calling CreateUserTable(10) is created table with name User_Table_10
Hope this helps
And please, if you have another question about this block, reply to this message and do not create a new thread
Pavlin II[/size]
Don't take life too seriously anyway you won't escape alive from it!