public int Delete(string _replyid)
{
string sql = "delete from Reply where Replyld = '" + _replyid + "'";
Database db = new Database();
int count = db.ExecuteSQL(sql);
return count;
}怪事,删除不了数据,都一个方法,在其它的表可以,我晕,怪
{
string sql = "delete from Reply where Replyld = '" + _replyid + "'";
Database db = new Database();
int count = db.ExecuteSQL(sql);
return count;
}怪事,删除不了数据,都一个方法,在其它的表可以,我晕,怪
_replyid.trim();删除空格
我手动给一个ReplyID都不行,就是删除不了,查询器里可以删除掉的,怪
全发出来看吧,也许知道什么原因了
我只要确定你这点 如果是 就把webConfige文件内容乖乖的发出来~~-_-!
<?xml version="1.0"?>
<!--
注意: 除了手动编辑此文件以外,您还可以使用
Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的
“网站”->“Asp.Net 配置”选项。
设置和注释的完整列表在
machine.config.comments 中,该文件通常位于
\Windows\Microsoft.Net\Framework\v2.x\Config 中
-->
<configuration>
<appSettings>
<add key="DBConnectionString" value="server=(local);user id=kaka; pwd=123456;database=sos"/>
</appSettings>
<connectionStrings/>
<system.web>
<!--
设置 compilation debug="true" 将调试符号插入
已编译的页面中。但由于这会
影响性能,因此只在开发过程中将此值
设置为 true。
-->
<roleManager enabled="true" />
<authorization>
<allow users="?" />
</authorization>
<compilation debug="true"/>
<!--
通过 <authentication> 节可以配置 ASP.NET 使用的
安全身份验证模式,
以标识传入的用户。
-->
<authentication mode="Forms" />
<!--
如果在执行请求的过程中出现未处理的错误,
则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
开发人员通过该节可以配置
要显示的 html 错误页
以代替错误堆栈跟踪。
-->
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
<pages validateRequest="false" />
</system.web>
</configuration>
然后去你的程序文件夹下(就是你放程序文件的地方),bin->debug文件下应该会生成mdf的数据库文件
你试验下用sqlserver打开他们 看看你刚才删除的数据是不是被删除了
如果是的话 我怀疑就是
<add key="DBConnectionString" value="server=(local);user id=kaka; pwd=123456;database=sos"/>
红色的地方有问题
仔细看了你代码
string sql = "delete from Reply where Replyld = '" + _replyid + "'";
Database db = new Database();
int count = db.ExecuteSQL(sql);
return count;
这是你代码 db.ExecuteSQL(sql);
你的SqlCommand呢? 晕 难道...