public string SynchronousData()
{
ReturnJson Rejson =new ReturnJson();
//将WebConfig中的数据库连接name中的值写进来
string connS=ConfigurationManager.ConnectionStrings["name"].ConnectionString;
using (SqlConnection conn=new SqlConnection(connectionSub))
{
conn.Open();
using (SqlCommand cmd= conn.CreateCommand())
{
try
{
cmd.CommandText ="存储过程名";
cmd.CommandType = CommandType.StoredProcedure;
var ReExcute= cmd.ExecuteNonQuery();
if (ReExcute >=0)
{
conn.Close();
Rejson.Code ="1";
Rejson.Errmsg ="同步成功";
return ToJson(Rejson);
}
else
{
conn.Close();
Rejson.Code ="0";
Rejson.Errmsg ="同步失败";
return ToJson(Rejson);
}
}
catch
{
conn.Close();
Rejson.Code ="3";
Rejson.Errmsg ="未知异常";
return ToJson(Rejson);
}
}
}
}