动态创建MSSQL数据库表存储过程

时间:2010-01-29 13:28:10  来源:第二电脑网  作者:第二电脑网

  第二电脑网导读:ata.SqlClient      Public Class Form1    Inherits System.Windows.Forms.Form    Private ConnectionString As String = "Data Source=.;Initial Catalog=;User Id=sa;Password=;"    Private reader As SqlDataReader = Nothing    Private conn As SqlConnection = Not...
  正文: 下面是利用SQL语句创建数据库、表、存储过程、视图、索引、规则、修改表、查看数据等的方法。所要增加的控件如下:
  
  以下是引用片段:
  Imports System.Data
  Imports System.Data.SqlClient
  
  Public Class Form1
   Inherits System.Windows.Forms.Form
   Private ConnectionString As String = "Data Source=.;Initial Catalog=;User Id=sa;Password=;"
   Private reader As SqlDataReader = Nothing
   Private conn As SqlConnection = Nothing
   Private cmd As SqlCommand = Nothing
   Private AlterTableBtn As System.Windows.Forms.Button
   Private sql As String = Nothing
   Private CreateOthersBtn As System.Windows.Forms.Button
  
  #Region " Windows 窗体设计器生成的代码 "
   '窗体重写处置以清理组件列表。
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
   If disposing Then
   If Not (components Is Nothing) Then
   components.Dispose()
   End If
   End If
   MyBase.Dispose(disposing)
   End Sub
   Public Sub New()
   MyBase.New()
   InitializeComponent()
   End Sub
   Private components As System.ComponentModel.IContainer
   Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
   Friend WithEvents CreateDBBtn As System.Windows.Forms.Button
   Friend WithEvents CreateTableBtn As System.Windows.Forms.Button
   Friend WithEvents CreateSPBtn As System.Windows.Forms.Button
   Friend WithEvents CreateViewBtn As System.Windows.Forms.Button
   Friend WithEvents btnAlterTable As System.Windows.Forms.Button
   Friend WithEvents btnCreateOthers As System.Windows.Forms.Button
   Friend WithEvents btnDropTable As System.Windows.Forms.Button
   Friend WithEvents btnViewData As System.Windows.Forms.Button
   Friend WithEvents btnViewSP As System.Windows.Forms.Button
   Friend WithEvents btnViewView As System.Windows.Forms.Button
   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
   Me.CreateDBBtn = New System.Windows.Forms.Button()
   Me.CreateTableBtn = New System.Windows.Forms.Button()
   Me.CreateSPBtn = New System.Windows.Forms.Button()
   Me.CreateViewBtn = New System.Windows.Forms.Button()
   Me.btnAlterTable = New System.Windows.Forms.Button()
   Me.btnCreateOthers = New System.Windows.Forms.Button()
   Me.btnDropTable = New System.Windows.Forms.Button()
   Me.btnViewData = New System.Windows.Forms.Button()
   Me.btnViewSP = New System.Windows.Forms.Button()
   Me.btnViewView = New System.Windows.Forms.Button()
   Me.DataGrid1 = New System.Windows.Forms.DataGrid()
   CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
   Me.SuspendLayout()
   '
   'CreateDBBtn
   '
   Me.CreateDBBtn.Location = New System.Drawing.Point(19, 9)
   Me.CreateDBBtn.Name = "CreateDBBtn"
   Me.CreateDBBtn.Size = New System.Drawing.Size(104, 23)
   Me.CreateDBBtn.TabIndex = 0
   Me.CreateDBBtn.Text = "创建数据库"
   '
   'CreateTableBtn
   '
   Me.CreateTableBtn.Location = New System.Drawing.Point(139, 9) "动态创建MSSQL数据库表存储过程"由第二电脑网原创提供,转载请注明:http://www.002pc.com/master/College/Programming/aspnet/12587.html

 1/5    1 2 3 4 5 下一页 尾页


关键字:
上一篇:返回列表

关于《动态创建MSSQL数据库表存储过程》文章的评论

站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td