Asp.Net三层架构 [英] Asp.Net three-tier architecture
本文介绍了Asp.Net三层架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
实际上,我正在研究一个Asp.Net三层体系结构项目.当我尝试
为数据访问层编写代码我在下面遇到错误.请帮忙. (已删除电子邮件)
Actually I’m working on an Asp.Net three-tier architecture project. When I try to
write code for the data access layer I’m getting the error below. Please help. (email removed)
public int insertlogin(DataContainer objdc,string CmdText)
{
Util.Open();
SqlCommand Cmd = new SqlCommand();
Cmd.Parameters.Clear();
Cmd.Connection = Util.SqlCon;
Cmd.CommandType = CommandType.StoredProcedure;
Cmd.CommandText = CmdText;
Cmd.Parameters.Add("@id", SqlDbType.Int).Value = objdc.id;
Cmd.Parameters.Add("@username", SqlDbType.VarChar, 50).Value = objdc.username;
Cmd.Parameters.Add("@password", SqlDbType.VarChar, 50).Value = objdc.password;
Cmd.ExecuteNonQuery();
Util.Close();
}
推荐答案
您尚未从例程中返回任何内容(需要返回int值)
You haven''t returned anything from the routine (needs to return an int value)
public int insertlogin(DataContainer objdc,string CmdText)
{
Util.Open();
SqlCommand Cmd = new SqlCommand();
Cmd.Parameters.Clear();
Cmd.Connection = Util.SqlCon;
Cmd.CommandType = CommandType.StoredProcedure;
Cmd.CommandText = CmdText;
Cmd.Parameters.Add("@id", SqlDbType.Int).Value = objdc.id;
Cmd.Parameters.Add("@username", SqlDbType.VarChar, 50).Value = objdc.username;
Cmd.Parameters.Add("@password", SqlDbType.VarChar, 50).Value = objdc.password;
Cmd.ExecuteNonQuery();
Util.Close();
int loginReturnValue = 0; // Populate whatever the return value should be?
return loginReturnValue;
}
在这里,我发布了链接,下载了三层体系结构的示例项目....
C#中的3层体系结构 [
Here i post the link download the sample project of the three tier architecture....
3-tier architecture in C#[^]
Best OF Luck.....
将此内容用于3层:
http://www.dotnetfunda.com/articles/article71.aspx [
refer this for 3-tier:
http://www.dotnetfunda.com/articles/article71.aspx[^]
hope this helps :)
这篇关于Asp.Net三层架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文