ASP.Net 3层架构参数声明 [英] ASP.Net 3-Tier architecture parameters declaration

查看:78
本文介绍了ASP.Net 3层架构参数声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我是3层架构的新手.
谁能帮助我在哪里声明(我的意思是哪一层)以及如何声明SQL Server存储过程的参数.
我正在使用存储过程将值插入表中.
假设我的SP是

Hi All,

I am new to 3-Tier architecture.
Can anyone help me where(I mean which layer) to declare and how to declare parameters for sql server stored procedure.
I am using stored procedure to insert values into the table.
Suppose my SP is

create procedure sp_insert
@fname varchar,
@lname varchar
As
Begin
Insert into emp(firstname,lastname) values(@fname,@lname);
End



现在使用asp.net Web表单,将值插入表中.
在Web表单中,我有两个文本框txtfirstname和txtlastname和一个按钮.
谁能告诉我要在每一层mailny变量/参数声明中编写的代码.
我浏览了许多文章,但感到困惑.

我只需要为该示例编写每层代码的粗略草图.

谢谢您,



Now using asp.net web form, I am inserting values into the table.
Here in web form I have two textboxes txtfirstname and txtlastname and a button.
Can anyone tell me the code to be written in each layer mailny variable/parameters declaration.
I went through many articles but getting confusion.

Just I need rough sketch of each layer code to be written for this example.

Thank you,

推荐答案

您已经问了几个有关3层体系结构及其实现方法的问题.每个问题都收到了很好的答案和教程.每次您提出相当开放的问题,这些问题很难具体回答.我的建议是找到一本有关如何架构应用程序的好书或视频系列.例如, Pluralsight [ ^ ]对于此类应用程序开发具有出色的视频培训库.它不是免费的,但绝对值得.

我不想听起来像是在回避您的提问,但从某种程度上来说,我想我是.原因是通常取决于最佳答案.例如,我会说这些变量可能会在业务层中放在一起,但我也在用户界面层和数据访问层中构建了它们.这完全取决于环境,这使我无法为您提供具体的答案.

关于如何使用这些参数调用存储过程,本教程将有所帮助:

http://www.csharp-station.com/Tutorial/AdoDotNet/lesson07 [ ^ ]
You have already asked a couple questions about 3-tiered architecture and how to accomplish it. Each question has received good answers and tutorials. Each time you ask fairly open-ended questions that are difficult to answer specifically. My suggestion would be to find a good book or video series on how to architect applications. For example, Pluralsight[^] has a great video training library for this type of application development. It isn''t free but it is definitely worth it.

I don''t want to sound like I''m avoiding your questionm, but in a way I guess I am. The reason is that usually it depends is the best possible answer. For instance, I would say that probably those variables would get put together in the business layer but I have also built them in the User Interface layer and in the data access layer. It all depends on the circumstances, which makes it impossible for me to give you a specific answer.

As to how to call the stored procedure using those parameters, this tutorial will help:

http://www.csharp-station.com/Tutorial/AdoDotNet/lesson07[^]


这篇关于ASP.Net 3层架构参数声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆