public class Services
{
public string ServiceNo = null;
public string ServiceState = null;
}
private int _AppendService(Services serv)
{
return SqlHelper.ExecuteNoQuery("INSERT INTO wfServices([ServiceNo], [ServiceState]) VALUES ('" + serv.ServiceNo + "', '" + serv.ServiceState + "')");
}
public bool AppendService(string strJSON)
{
// strJSON = "{\"ServiceNo\":\"1\",\"ServiceState\":\"C\"}";
return (1 == _AppendService(JavaScriptConvert.DeserializeObject(strJSON, typeof(Services)) as Services));
}
{
public string ServiceNo = null;
public string ServiceState = null;
}
private int _AppendService(Services serv)
{
return SqlHelper.ExecuteNoQuery("INSERT INTO wfServices([ServiceNo], [ServiceState]) VALUES ('" + serv.ServiceNo + "', '" + serv.ServiceState + "')");
}
public bool AppendService(string strJSON)
{
// strJSON = "{\"ServiceNo\":\"1\",\"ServiceState\":\"C\"}";
return (1 == _AppendService(JavaScriptConvert.DeserializeObject(strJSON, typeof(Services)) as Services));
}
本文介绍了一个使用C#实现的服务数据插入方法。通过定义一个名为Services的公共类及其属性,并提供了一个私有方法_AppendService用于将数据插入到数据库中。此外,还展示了一个公共方法AppendService,该方法接受JSON字符串作为输入参数,将其转换为Services对象并调用_AppendService方法完成数据插入。
1万+

被折叠的 条评论
为什么被折叠?



