有示例代码么,可以用来参考的
追答注释什么的 这里没管
追问不知道是不是我没有看懂,这个好像只是把脚本读取吧,有没有执行呢
追答?? 跟增删改 什么的 不都一样吗? 语句都有了 套一下 不就可以吗?
追问我需要的就是后面执行的部分。。。。
追答foreach(string sqlstr in GetTsqlsFormSqlFile("D:\\111.sql"))
{
SqlCommand cmd = new SqlCommand(sqlstr, this.sqlcon);
cmd.CommandType = CommandType.Text;
this.sqlcon.Open();
int count = cmd.ExecuteNonQuery();
this.sqlcon.Close();
}
比如现在我有一个sql更新脚本,我希望通过这个程序让对应的数据库执行脚本内容,自动完成更新
追答你的意思是类似于数据库引擎的功能,这个还不会。
追问就是读取脚本的每一行,然后执行,其他的我也说不清楚。。。。还是谢谢你了