我在做三层体系时,数据怎么老是插不进数据库,检查过了好象没什么问提嘛,望哪位指点一下,就是表示层创建一个业务规则层的一个新的对象,Modules.Accounts.Business.Blog newBlog = new Modules.Accounts.Business.Blog();
string [] str = Request.Form["hiddenTemp"].Split('$');
newBlog.Filename = txtTitle.Text; 我的业务规则层是
//调用数据访问层的Create创建记录,返回的参数确认创建成功
public bool Create()
{
Modules.Accounts.Data.blog datablog = new Data.blog(connectionString);
return datablog.Create(
id,
filename,
emittime,
subject,
email,
image,
visitcount
);
} 我的数据访问层是
//基于提供的参数创建新的博客记录。返回的参数确认创建成功
public bool Create(string id,
//string username,
string filename,
string emittime,
string subject,
string email,
string image,
string visitcount
)
{
string strSQL = "INSERT INTO blog(id, filename,emittime,subject, email, image, visitcount) VALUES(";
strSQL += "'" + id + "',";
strSQL += "'" + filename + "')";
// strSQL += "'" + Convert.ToBase64String(password) + "',";
strSQL += "'" + emittime + "',";
strSQL += "'" + subject + "',";
strSQL += "'" + email + "',";
strSQL += "'" + image + "',";
strSQL += "'" + visitcount + "')";
请问我哪里错了吗?为什么就插不进数据库?谢谢!
string [] str = Request.Form["hiddenTemp"].Split('$');
newBlog.Filename = txtTitle.Text; 我的业务规则层是
//调用数据访问层的Create创建记录,返回的参数确认创建成功
public bool Create()
{
Modules.Accounts.Data.blog datablog = new Data.blog(connectionString);
return datablog.Create(
id,
filename,
emittime,
subject,
email,
image,
visitcount
);
} 我的数据访问层是
//基于提供的参数创建新的博客记录。返回的参数确认创建成功
public bool Create(string id,
//string username,
string filename,
string emittime,
string subject,
string email,
string image,
string visitcount
)
{
string strSQL = "INSERT INTO blog(id, filename,emittime,subject, email, image, visitcount) VALUES(";
strSQL += "'" + id + "',";
strSQL += "'" + filename + "')";
// strSQL += "'" + Convert.ToBase64String(password) + "',";
strSQL += "'" + emittime + "',";
strSQL += "'" + subject + "',";
strSQL += "'" + email + "',";
strSQL += "'" + image + "',";
strSQL += "'" + visitcount + "')";
请问我哪里错了吗?为什么就插不进数据库?谢谢!
是用存储过程么?把数据库设计好了。然后用查询分析器测试一下 自己写的sql代码了。insert update delete select一个表写四个,好好测试一下么
放个断点在后面截取下sql语句 用数据库执行下试试