: in my project i want tables to be created automatically during runtime
: for each user who are all creating new id
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?
...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)
XXX - 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
Don't take life too seriously anyway you won't escape alive from it!