Create sql table using TableAdapter

All replies

  • Hello,

    There are no provisions for a TableAdapter to create a new SQL Table. You would need to init a SqlClient connection and command then use ExecuteNonQuery to create a table.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Tuesday, February 12, 2019 7:35 PM
  • Hi,


     cmd = New SqlCommand("CREATE TABLE mytable" & "(myId INTEGER CONSTRAINT PKeyMyId PRIMARY KEY," & "myName CHAR(50), myAddress CHAR(255), myBalance FLOAT)", conn)

    Best Regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Wednesday, February 13, 2019 5:18 AM