存储过程简单定义,表复习

来源:互联网 发布:高清网络编码器 编辑:程序博客网 时间:2024/06/04 19:31

今天学习了存储过程的定义方法

首先

CREATEPROC[EDURE] 存储过程的名字

然后begin

然后就是要执行的sql命令语句

最后end

这是简单的存储过程的定义方法

 

表:

创建表

DataTable table1=NewDataTable() ;

创建表的行

DataRowrow=table1.NewRow();   此处要注意

创建列

DataColumn c1 = newDataColumn("id",typeof (int));

 

Table1.column.add(c1); 添加新列

 

DataTable dt = new DataTable();

        DataColumndc = new DataColumn();

        dc.ColumnName = "id";

        dc.DataType = typeof(int);

        dc.AllowDBNull = false;

        dc.AutoIncrement = true;

        dc.AutoIncrementSeed = 1;

        dc.AutoIncrementStep = 1;

        dt.Columns.Add(dc);

        dc = newDataColumn();

        dc.ColumnName = "name";

        dc.DataType = typeof(string);

        dc.AllowDBNull = false;

        dt.Columns.Add(dc);

        DataRowrow = dt.NewRow();

        row["name"]= "zhangsa";

        dt.Rows.Add(row);

        this.DropDownList1.DataSource= dt;

        this.DropDownList1.DataTextField= "name";

        this.DropDownList1.DataValueField= "id";

        this.DropDownList1.DataBind();

原创粉丝点击