创建动态MSSQL数据库表的方法
代码如下: 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"Windows窗体设计器生成的代码"
'窗体重写处置以清理组件列表。
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
FriendWithEventsbtnViewViewAsSystem.Windows.Forms.Button
PrivateSubInitializeComponent()
代码如下: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="创建数据库"
'
'CreateTableBtn
'
Me.CreateTableBtn.Location=NewSystem.Drawing.Point(139,9)
Me.CreateTableBtn.Name="CreateTableBtn"
Me.CreateTableBtn.TabIndex=1
Me.CreateTableBtn.Text="创建表"
'
'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="创建存储过程"
'
'CreateViewBtn
'
Me.CreateViewBtn.Location=NewSystem.Drawing.Point(350,9)
Me.CreateViewBtn.Name="CreateViewBtn"
Me.CreateViewBtn.TabIndex=3中国网管联盟www.bitscn.com
Me.CreateViewBtn.Text="创建视图"
'
'btnAlterTable
'
Me.btnAlterTable.Location=NewSystem.Drawing.Point(441,9)
Me.btnAlterTable.Name="btnAlterTable"
Me.btnAlterTable.TabIndex=4
Me.btnAlterTable.Text="修改表"
#p#
创建动态MSSQL数据库表的方法的更多相关文章
- EFCore 通过实体Model生成创建SQL Server数据库表脚本
在我们的项目中经常采用Model First这种方式先来设计数据库Model,然后通过Migration来生成数据库表结构,有些时候我们需要动态通过实体Model来创建数据库的表结构,特别是在创建像临 ...
- Atitit.mssql 数据库表记录数and 表体积大小统计
Atitit.mssql 数据库表记录数and 表体积大小统计 1. EXEC sp_MSforeachtable "EXECUTE sp_spaceused '?'&quo ...
- 数据库表结构设计方法及原则(li)
数据库设计的三大范式:为了建立冗余较小.结构合理的数据库,设计数据库时必须遵循一定的规则.在关系型数据库中这种规则就称为范式.范式是符合某一种设计要求的总结.要想设计一个结构合理的关系型数据库,必须满 ...
- MySQL-5.7创建及查看数据库表
1.创建数据库表的三种语句 创建一个新表: CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name (create_definition,...) [tab ...
- Django中利用type动态操作数据库表
场景分析: 后台MySql数据库保存了一大批按股票代码命名的数据表,每张表保存的是每只股票的日线数据. stock_000002 stock_600030 stock_600020 ...一共3000 ...
- django 创建model(数据库表)失败
在models.py中创建数据库表 from django.db import models # Create your models here. class Book(models.Model) ...
- MySQL创建和操作数据库表demo
[1]建立员工档案表要求字段:员工员工编号,员工姓名,性别,工资,email,入职时间,部门. [2]合理选择数据类型及字段修饰符,要求有NOT NULL,auto_increment, primar ...
- java反射的应用+mybatis+spring动态生成数据库表
最近接触了一个类似于代码生成工具的活.思路是,通过java的反射机制得到类的字段和字段类型, 从而可以创建一个map集合存储表名(由类名决定的特殊结构字符串),表字段(由类变量确定),表字段类型(由变 ...
- iOS:CoreData数据库的使用二(创建多个数据库表,表之间有对应关系)
CoreData数据库框架是一个封装性好,功能强大数据库,它底层使用的还是sqlite数据库,不过苹果公司在其基础上,为其封装新和安全性的维护上做了大量的处理,例如对一些事物做了详细的操作,如读脏数据 ...
随机推荐
- VS2010-如何建立并运行多个含有main函数的文件
一.先说两个概念,解决方案与工程 在VS2010中,工程都是在解决方案管理之下的.一个解决方案可以管理多个工程,可以把解决方案理解为多个有关系或者没有关系的工程的集合. 每个应用程序都作为一个工程来处 ...
- 《DSP using MATLAB》Problem 8.9
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- Django项目: 项目环境搭建 ---- 二、django项目设置
1.配置模板文件 TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.p ...
- 11-7-this的最基本认识
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- js 实现横向轮播效果
参考:https://www.cnblogs.com/LIUYANZUO/p/5679753.html html: <!DOCTYPE html> <html> <hea ...
- java笔试之取近似值
写出一个程序,接受一个正浮点数值,输出该数值的近似整数值.如果小数点后数值大于等于5,向上取整:小于5,则向下取整. package test; import java.util.*; import ...
- Apache 禁用IP 访问 和 HTTP 跳转 HTTPS
如果需要 禁用IP 访问并且 需要 HTTP 跳转到 HTTPS <VirtualHost *:80> ServerName xxx.xxx.com RewriteEngine On Re ...
- springboot+atomikos+多数据源管理事务(mysql 8.0)
jta:Java Transaction API,即是java中对事务处理的api 即 api即是接口的意思 atomikos:Atomikos TransactionsEssentials 是一个为 ...
- https://blog.csdn.net/u012235003/article/details/54576737
https://blog.csdn.net/u012235003/article/details/54576737
- 微信小程序--导航跟随
最近开发小程序的时候遇到这样一个需求:如图1 页面向下滚动到白色导航的位置时,白色导航固定到页面最上方:当页面向上滚动到白色导航时,白色导航恢复到原始位置:点击各个导航,平滑的跳到相应位置. 思路1: ...