Tips for creating a dynamic MSSQL database table (1): You don't need any other functions to support it. you only need to use some SQL statements provided by MYSQL. For the sake of simplicity, take the MYSQL system table USER as an example to retrieve all possible values in the SELECT_PRIV column. Method: show columns from table_name LIKE enum_column_name the lower-case section needs to be changed according to your situation.
In fact, there is no need for other functions to support it. you only need to use some SQL statements provided by MYSQL.
For the sake of simplicity, take the MYSQL system table USER as an example to retrieve all possible values in the SELECT_PRIV column.
Method: show columns from table_name LIKE enum_column_name
The lower case must be changed according to your situation.
Program:
// By SonyMusic (sonymusic@163.com)
// HomePage (phpcode.yeah.net)
$ Connect_hostname = "localhost ";
$ Dbn The following describes how to use SQL statements to create databases, tables, stored procedures, views, indexes, rules, modify tables, and view data. The following controls are added:
The following is a reference clip:
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 "code generated by Windows Form Designer"
'Form rewriting disposal to clear the component list.
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 ");
Network management network 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]."
";
}
?>