ContentText.contents 不可访问,因为它受保护级别限制
public class Operator
{
public Operator()
{
//
//TODO: 在此处添加构造函数逻辑
//
}
public static SqlConnection ConnecionDB()
{
SqlConnection con = new SqlConnection("server=.;DataBase=ContentDB;Trusted_Connection=true;");
return con;
}
public static bool AddContent(ContentText ct)
{
try {
SqlConnection con = Operator.ConnecionDB();
con.Open();
string str = "insert into ContentText(userName,tel,email,contents)values(@userName,@tel,@email,@contents)";
SqlCommand cmd = new SqlCommand(str,con);
SqlParameter param = new SqlParameter("@userName",SqlDbType.Char,10);
param.Value=ct.userName;
cmd.Parameters.Add(param);
param = new SqlParameter("@email",SqlDbType.Char,20);
param.Value=ct.email;
cmd.Parameters.Add(param);
param = new SqlParameter("@tel",SqlDbType.Char,20);
param.Value = ct.tel;
cmd.Parameters.Add(param);
param = new SqlParameter("@contents",SqlDbType.NVarChar);
param.Value = ct.contents;
cmd.Parameters.Add(param);
cmd.ExecuteNonQuery();
return true;
}
catch
{
return false;
}
}
}
都是public 怎么也不行 啊 求指导
{
public Operator()
{
//
//TODO: 在此处添加构造函数逻辑
//
}
public static SqlConnection ConnecionDB()
{
SqlConnection con = new SqlConnection("server=.;DataBase=ContentDB;Trusted_Connection=true;");
return con;
}
public static bool AddContent(ContentText ct)
{
try {
SqlConnection con = Operator.ConnecionDB();
con.Open();
string str = "insert into ContentText(userName,tel,email,contents)values(@userName,@tel,@email,@contents)";
SqlCommand cmd = new SqlCommand(str,con);
SqlParameter param = new SqlParameter("@userName",SqlDbType.Char,10);
param.Value=ct.userName;
cmd.Parameters.Add(param);
param = new SqlParameter("@email",SqlDbType.Char,20);
param.Value=ct.email;
cmd.Parameters.Add(param);
param = new SqlParameter("@tel",SqlDbType.Char,20);
param.Value = ct.tel;
cmd.Parameters.Add(param);
param = new SqlParameter("@contents",SqlDbType.NVarChar);
param.Value = ct.contents;
cmd.Parameters.Add(param);
cmd.ExecuteNonQuery();
return true;
}
catch
{
return false;
}
}
}
都是public 怎么也不行 啊 求指导
...全文
相关推荐
前端开发基于history.js的HTML5与HTML4浏览器兼容方案:单页应用无刷新历史状态管理技术实现-5Z6jeSqI1792158476
内容概要:本文系统介绍了如何利用history.js实现单页应用(SPA)在HTML5c与HTML4浏览器间s草错发的无缝历史状态管理。通过封装原生History API并在不支持的浏览器中自动降级为哈希路由,history.js解决了因浏览器兼容性导致的后退按钮失效、URL混乱等问题。文章详细讲解了其核心机制,包括状态对象管理、自动模式切换(HTML5 pushState vs HTML4 哈希)、状态数据持久化以及针,对Safari、IE等浏\览器的兼容性修复方案,并提供了从入门到实战的完整示例,涵盖初始化、事,件监听、页面加载及性能优化技巧。;5Z6jeSqI1792158476 sdhmgggw168.com www.shangliangwangye.com www.sdbing.net migu.blsxex.abxlbz.sc.cn www.safespeed.net.cn
高校如何通过科技报告服务提升技术转移转化效率?.docx
科易网基于40亿+科创知识图谱数据库,深度探索AI技术在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,研究科技创新领域的AI+数智化解决方案,推动科技创新与产业创新智能化发展。
科技服务机构如何提升服务大企业的技术诊断能力?.docx
科技服务机构如何提升服务大企业的技术诊断能力?
央企如何通过市场数据优化数字化转型战略?.docx
央企如何通过市场数据优化数字化转型战略?
园区如何通过数据分析实现精准招商引资?.docx
园区如何通过数据分析实现精准招商引资?


