程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> SqlServer數據庫 >> 關於SqlServer >> 教你創建動態MSSQL 數據庫表(1)

教你創建動態MSSQL 數據庫表(1)

編輯:關於SqlServer
   提示:這裡其實並不需要其它的什麼函數來支持,只需要使用MYSQL提供的一些SQL語句就可以了。 這裡為了簡單起見,以MySQL的系統表USER為例,取出SELECT_PRIV這一列的所有可能值。 方法:SHOW COLUMNS FROM table_name LIKE enum_column_name 小寫的部分需要根據你的情況改變。


這裡其實並不需要其它的什麼函數來支持,只需要使用MySQL提供的一些SQL語句就可以了。
  這裡為了簡單起見,以MySQL的系統表USER為例,取出SELECT_PRIV這一列的所有可能值。

  方法:SHOW COLUMNS FROM table_name LIKE enum_column_name

  小寫的部分需要根據你的情況改變。

  程序: 


  //By SonyMusic([email protected])
  //HomePage(PHPcode.yeah.Net)
  $connect_hostname="localhost";
  $dbn下面是利用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
  Private Sub InitializeComponent()

ame="MySQL";
  $connect_username = "root";
  $connect_pass ="";
  $connect_id = MySQL_connect($connect_hostname, $connect_username, $connect_pass);
  MySQL_select_db($dbname);
  $query="show columns from user like 'select_priv'";
  $result=MySQL_db_query($dbname,$query);
  $enum=MySQL_result($result,0,"type");
  網管網bitsCN_com
  echo $enum."
";
  $enum_arr=explode("(",$enum);
  $enum=$enum_arr[1];
  $enum_arr=explode(")",$enum);
  $enum=$enum_arr[0];
  $enum_arr=explode(",",$enum);
  for($i=0;$i 
  echo $enum_arr[$i]."
";
  }
  ?>

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved