Creating tables in dynamically in web developer 2008?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saadkhan
    New Member
    • Aug 2008
    • 40

    Creating tables in dynamically in web developer 2008?

    plz help me that how can i create tables in database using web developer?
    Actually i want to make tables dynamically whenever new user registers to my website. I`v created the first part using asp.net builtin database feature. I am able to enter new users info in my table but want to create another table specially for tht user!
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    The most obvious way to do it would be to pass a "create table" via SQL. Have you ever done anything like that before?

    Jared

    BTW, I've moved you over to the .NET forum. The ASP forum is for "classic" ASP, not ASP.NET

    Comment

    • l034n
      New Member
      • Oct 2008
      • 15

      #3
      [code=vbnet]private DataTable GetSimpleDataTa ble()
      {
      DataTable dt = new DataTable("MyTa ble");
      dt.Columns.AddR ange(new DataColumn[] { new DataColumn("Col umn1"), new DataColumn("Col umn2") });
      dt.Rows.Add(new string[] { "Row1Col1", "Row1Col2" });
      dt.Rows.Add(new string[] { "Row2Col1", "Row2Col2" });
      dt.Rows.Add(new string[] { "Row3Col1", "Row3Col2" });
      return dt;
      }[/code]

      That way you have in-memory data table and you may use it for whatever you want.
      Cheers
      Last edited by Frinavale; Oct 3 '08, 04:01 PM. Reason: added [code] tags

      Comment

      • jhardman
        Recognized Expert Specialist
        • Jan 2007
        • 3405

        #4
        That's a good solution, then if you wanted to put it in the db when done, you can just use an adapter.

        Jared

        Comment

        • Curtis Rutland
          Recognized Expert Specialist
          • Apr 2008
          • 3264

          #5
          Do you think that it is wise to create another table for each user? perhaps you should use one table that relates to another with the userid being the key.

          Comment

          Working...