创建动态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数据库,不过苹果公司在其基础上,为其封装新和安全性的维护上做了大量的处理,例如对一些事物做了详细的操作,如读脏数据 ...
随机推荐
- MyEclipse使用总结——将原有的MyEclipse中的项目转成maven项目[转]
前面一篇文章中我们了解了 在myeclipse中新建Maven框架的web项目 那么如果我们原来有一些项目现在想转成maven项目应该怎么做呢 我收集到了三种思路: 一.新建一个maven项目,把原项 ...
- 安装hadoop伪分布式
修改hosts cat /etc/hosts 127.0.0.1 mo.don.com 创建用户 useradd hadoop passwd hadoop sudo授权 visudo hadoop A ...
- 从xmlns的作用说起
查了资料和自己实践后,得出了一些关于xml和xmlns的结论 看一个最常见的javaweb 中xml配置文件的开头: <?xml version="1.0" encoding ...
- mysql 乐观判断 校验
说下场景, 用户账户 有 100 元钱, 他执行了两个操作, A操作发红包发了80块钱, B操作 发红包 发了 70 ,并发, 假如没有 冻结这一说法, 两个操作都是去 查询余额, 还有100 ...
- Redis系列一之《Redis设计与实践》整体观感
笔者别的Redis方面的书没有读过,读完这一本,力荐,作者黄建宏,对Redis不太熟悉的,但是对编程稍微有些基础的,全部 读下来应该无压力.作者的编写和讲解非常详细,覆盖的面基本上都讲到,之前一直都是 ...
- SpringMVC处理请求的大致流程是怎么样的
SpringMVC请求处理流程 Spring MVC请求处理架构图: 1.用户首先发送请求到前端控制器Dispatcher Servlet, 2.在doDispath这个方法中会为请求找到对 ...
- 设置listContrl中指定行的颜色
在MFC中 自己通过手动拖放CListCtrl控件来制作自己的表格: 目的: 将指定item的行更该颜色: 步骤: 1,在窗口中拖放CListCtrl控件, 单击右键 创建控件对象: CListCtr ...
- 解决windows8.1的依赖
- Linux产生coredump文件(core)
1.可以使用命令 ulimit -c unlimited 来开启 core dump 功能,并且不限制 core dump 文件的大小: 如果需要限制文件的大小,将 unlimited 改成你想生成 ...
- BZOJ 1822[JSOI2010]Frozen Nova 冷冻波
网络流+二分. n^3枚举判断每个巫妖可以攻击的精灵,向其连1的边,每个精灵向汇点连1的边. 二分答案,修改源点流向每个巫妖的cap,跑最大流看是否等于精灵数. 恩,看起来没什么毛病. 然后狂WA不止 ...