db2 =>CREATE PROCEDURE GETDBNAME
db2 (cont.) => (OUT "DBNAME" VARCHAR(15)
db2 (cont.) => )
db2 (cont.) => LANGUAGE SQL
db2 (cont.) => BEGIN
db2 (cont.) =>
db2 (cont.) => SET DBNAME = (SELECT DB_NAME FROM TABLE(SNAP_GET_DB('',-1)) AS S)
db2 (cont.) =>
db2 (cont.) => END@
DB20000I SQL 命令成功完成。
db2 =>
db2 =>CALL GETDBNAME(?)@
输出参数的值
--------------------------
参数名: DBNAME
参数值: SAMPLE
返回状态 = 0
db2 =>
OleDbConnection1.Open()//打开数据库连接
OleDbDataAdapter1.Fill(dataSet1,"Address")
//将得来的数据填入dataSet
DataGrid1.DataBind()
//绑定数据
OleDbConnection1.Close()
//关闭连接
//增加数据库数据
在Web Form上新增对应字段数量个数的TextBox,及一个button,为该按键增加Click响应事件代码如下:
this.OleDbInsertCommand1.CommandText = "INSERTsintosADDRESS(NAME,
EMAIL, AGE, ADDRESS) VALUES
('"+TextBox1.Text+"','"+TextBox2.Text+"','"+TextBox3.Text+"','"+TextBox4.Text+"')"
OleDbInsertCommand1.Connection.Open()
//打开连接
OleDbInsertCommand1.ExecuteNonQuery()
//执行该SQL语句
OleDbInsertCommand1.Connection.Close()
//关闭连接
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)