示例一:
Dim conn As New OleDb.OleDbConnection
Dim cmmd As New OleDb.OleDbCommand
conn.ConnectionString = "provider=sqloledb;Data Source=127.0.0.1;Initial Catalog=hindarerp;Persist Security Info=True;User ID=sa;Password=sa"
conn.Open()
cmmd.Connection = conn
cmmd.CommandText = "truncate table mytable"
cmmd.ExecuteScalar()
conn.Close()
示例二:
Dim conn As New OleDb.OleDbConnection
Dim cmmd As New OleDb.OleDbCommand
conn.ConnectionString = "provider=sqloledb;Data Source=127.0.0.1;Initial Catalog=hindarerp;Persist Security Info=True;User ID=sa;Password=sa"
conn.Open()
cmmd.Connection = conn
cmmd.CommandText = "exec Hd_bom_add_data"
'执行存储过程
cmmd.ExecuteScalar()
conn.Close()
参考文献:
http://wenku.baidu.com/view/b7e31ad3b9f3f90f76c61bec .html