Create a dynamic MSSQL database table

Source: Internet
Author: User

The following is a reference clip:
Copy codeThe Code is as follows:
ImportsSystem. Data
ImportsSystem. Data. SqlClient
PublicClassForm1
InheritsSystem. Windows. Forms. Form
PrivateConnectionStringAsString = "DataSource =.; InitialCatalog =; UserId = sa; Password = ;"
PrivatereaderAsSqlDataReader = Nothing
PrivateconnAsSqlConnection = Nothing
PrivatecmdAsSqlCommand = Nothing
PrivateAlterTableBtnAsSystem. Windows. Forms. Button
PrivatesqlAsString = Nothing
PrivateCreateOthersBtnAsSystem. Windows. Forms. Button
# Region "code generated by Windows Form Designer"
'Form rewriting disposal to clear the component list.
ProtectedOverloadsOverridesSubDispose (ByValdisposingAsBoolean)
IfdisposingThen
IfNot (componentsIsNothing) Then
Components. Dispose ()
EndIf
EndIf
MyBase. Dispose (disposing)
EndSub
PublicSubNew ()
MyBase. New ()
InitializeComponent ()
EndSub
PrivatecomponentsAsSystem. ComponentModel. IContainer
FriendWithEventsDataGrid1AsSystem. Windows. Forms. DataGrid
FriendWithEventsCreateDBBtnAsSystem. Windows. Forms. Button
FriendWithEventsCreateTableBtnAsSystem. Windows. Forms. Button
FriendWithEventsCreateSPBtnAsSystem. Windows. Forms. Button
FriendWithEventsCreateViewBtnAsSystem. Windows. Forms. Button
FriendWithEventsbtnAlterTableAsSystem. Windows. Forms. Button
FriendWithEventsbtnCreateOthersAsSystem. Windows. Forms. Button
FriendWithEventsbtnDropTableAsSystem. Windows. Forms. Button
FriendWithEventsbtnViewDataAsSystem. Windows. Forms. Button
FriendWithEventsbtnViewSPAsSystem. Windows. Forms. Button
Friendwitheventsbtnviewassystem. Windows. Forms. Button
PrivateSubInitializeComponent ()


  Copy codeThe Code is as follows:
Me. CreateDBBtn = NewSystem. Windows. Forms. Button ()
Me. CreateTableBtn = NewSystem. Windows. Forms. Button ()
Me. CreateSPBtn = NewSystem. Windows. Forms. Button ()
Me. CreateViewBtn = NewSystem. Windows. Forms. Button ()
Me. btnAlterTable = NewSystem. Windows. Forms. Button ()
Me. btnCreateOthers = NewSystem. Windows. Forms. Button ()
Me. btnDropTable = NewSystem. Windows. Forms. Button ()
Me. btnViewData = NewSystem. Windows. Forms. Button ()
Me. btnViewSP = NewSystem. Windows. Forms. Button ()
Me. btnViewView = NewSystem. Windows. Forms. Button ()
Me. DataGrid1 = NewSystem. Windows. Forms. DataGrid ()
CType (Me. DataGrid1, System. ComponentModel. ISupportInitialize). BeginInit ()
Me. SuspendLayout ()
'
'Createdbbtn
'
Me. CreateDBBtn. Location = NewSystem. Drawing. Point (19,9)
Me. CreateDBBtn. Name = "CreateDBBtn"
Me. CreateDBBtn. Size = NewSystem. Drawing. Size (104,23)
Me. CreateDBBtn. TabIndex = 0
Me. CreateDBBtn. Text = "create database"
'
'Createtablebtn
'
Me. CreateTableBtn. Location = NewSystem. Drawing. Point (139,9)
Me. CreateTableBtn. Name = "CreateTableBtn"
Me. CreateTableBtn. TabIndex = 1
Me. CreateTableBtn. Text = "create table"
'
'Createspbtn
'
Me. CreateSPBtn. Location = NewSystem. Drawing. Point (230,9)
Me. CreateSPBtn. Name = "CreateSPBtn"
Me. CreateSPBtn. Size = NewSystem. Drawing. Size (104,23)
Me. CreateSPBtn. TabIndex = 2
Me. CreateSPBtn. Text = "Create a stored procedure"
'
'Createviewbtn
'
Me. CreateViewBtn. Location = NewSystem. Drawing. Point (350,9)
Me. CreateViewBtn. Name = "CreateViewBtn"
Me. CreateViewBtn. TabIndex = 3 www.bitscn.com
Me. CreateViewBtn. Text = "create View"
'
'Btnaltertable
'
Me. btnAlterTable. Location = NewSystem. Drawing. Point (441,9)
Me. btnAlterTable. Name = "btnAlterTable"
Me. btnAlterTable. TabIndex = 4
Me. btnAlterTable. Text = "Modify Table"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.