VS2010 VB 连接数据库SQL2005

示例一:
 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()
上一篇:EFProf Entity Framework Profile 工具


下一篇:hdu 3336 Count the string KMP+DP优化