把写在.sql里面的语句取出(用读取文本文件的方法),构造成sql语句, 1.用SqlCommand执行;2.将构造成的sql语句存入数据库表中,写触发器执行; 取文本文件中的内容,可用System.IO.File 里面的方法 if (File.Exists(FILE_NAME)) //如果文件存在 { String[] strs = System.IO.File.ReadAllLines(FILE_NAME); if (strs != null && strs.Length > 0) { foreach (String s in strs) { ..... } } }
转载于:https://www.cnblogs.com/52zsy/archive/2012/10/09/2716976.html