AppConfig.DB.DefaultConn = "Server=10.3.4.125,8001;Database=FY_YYFLXT;User Id=ypflxt;Password=ypflxt66061436;";// "Data Source={0}demo.db;failifmissing=false;";
MProc proc = new MProc(" UPDATE kct02 SET kcczzt = 'E' WHERE kcckdm ='XDZZ' and kcczzt <> 'E' ", "Server=10.3.4.125,8001;Database=FY_YYFLXT;User Id=ypflxt;Password=ypflxt66061436;");
int result = proc.ExeNonQuery(); // 报这个错:ConnectionString 属性尚未初始化。![](https://img2022.cnblogs.com/q/683319/202201/683319-20220128172101887-1488594525.png)
不清楚,不过,你还不如直接使用ADO.NET呢
System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection("Server=10.3.4.125,8001;Database=FY_YYFLXT;User Id=ypflxt;Password=ypflxt66061436;");
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("UPDATE kct02 SET kcczzt = 'E' WHERE kcckdm ='XDZZ' and kcczzt <> 'E'");
cmd.Connection = con;
con.Open();
int result = cmd.ExecuteNonQuery();
con.Close();
是的,谢谢,正在往这个方向考虑了。thanks for your code
—— 那么应该有个初始化函数,可能需要你显示调用一次。