我需要真正的帮助! [英] I need real help!

查看:76
本文介绍了我需要真正的帮助!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在使用visual studio .net在vb.net中创建多层应用程序。


我创建了一个invoice.vb类文件,包含属性,事件和方法。这个

也有一个订单项集合类(lineitem.vb& lineitems.vb)。我创建了

a表单(form1.frm)并编写相应的代码来初始化发票

对象,表单上有文本框来显示数据,更新和

加载按钮。我的数据存储在一个访问数据库中。


问:我的对象应该如何与数据库交互?例如。当用户

输入所需属性等的值并点击更新时(我们

已经有发票对象的实例),后面的代码调用

设置发票类中相应属性的方法等。

问:这是否应该连接以更新数据库,如果是这样的话

怎么样?





问:我是否还有一个数据对象也是在发票时初始化

对象是和设置属性时传递更新命令?


我希望这对某人有意义!任何帮助都会很酷。


干杯

Hi All,

I am creating multi-tier app in vb.net using visual studio .net.

I create a invoice.vb class file with properties, events and methods. This
also has a line item collection class (lineitem.vb & lineitems.vb). I create
a form (form1.frm) and write the corresponding code to initialize an invoice
object, there are textboxes on the form to display the data, an update and
load button. My data is stored in an access database.

Q. How should my objects interact with the database? eg. When the user
enters in values for the required properties etc and clicks update (we
already have an instance of the invoice object), the code behind calls the
set method of the corresponding properties in the invoice class etc.
Q. Is this where the connection should be made to update the database, if so
how?

or

Q. Should I have a data object also that is initialized when a invoice
object is and update commands are passed through when properties are set?

I hope this makes sense to someone! any help would be cool.

Cheers

推荐答案

在大多数情况下,你会看到如下内容:


DAL - 数据访问层:

访问数据库的通用层。想法是你可以通过DAL快速切换出
数据库。有一个简单的设置方法,你可以使用Microsoft数据访问应用程序块。


注意:其中一个FillDataSet有一个错误() 方法。该行是:

tableName + = tableName +(index + 1).ToString();

应该是:

tableName ="表" +(index + 1).ToString();


数据层:

如果使用强类型数据集,则存储它们。


业务层:

业务对象。如果一个人更改数据,您应该有一个脏标志,或者类似于
,允许您触发更新事件。这里有两个选项

。首先是让类具有CRUD方法。第二个是用于填充各种业务对象的

助手类。保罗·谢里夫(Paul Sherriff)也有一个独特的想法,我喜欢这个想法,它拥有从DataSet派生的商业对象
。然后,您可以使用填充

强类型DataSet调用Update()的DataAdapter来更新业务对象。你会发现有些像罗克福德洛特卡喜欢更传统的商业

物品。如果你想领导这个方向,他的书非常值得

阅读。


UI层:

相当自我解释。


希望这有助于作为一般指导。


-

Gregory A. Beamer
MVP; MCP:+ I,SE,SD,DBA


**************************** ********************** ********************

在盒子外面思考!

************************************* ************* ********************

" pcthug" < PC ****** @ paradise.net.nz>在消息中写道

news:zT ******************** @ news02.tsnz.net ...
In most scenarios, you see something like the following:

DAL - Data Access Layer:
Generic layer to access the database. Idea is you can quickly switch out
databases by having a DAL. For an easy method of setting this up, you can
use the Microsoft Data Access Application Block.

NOTE: There is an error in one of the FillDataSet() methods. The line is:
tableName += tableName + (index + 1).ToString();
should be:
tableName = "Table" + (index + 1).ToString();

Data Layer:
If you use strongly typed datasets, this is where you store them.

Business Layer:
Business objects. If a person changes data, you should have a dirty flag, or
similar, that allows you to fire an update event. There are two options
here. The first is to have the class have CRUD methods. The second is a
helper class to fill the various business objects. There is also a unique
idea from Paul Sherriff, which I happen to like, that has the business
objects derive from DataSet. You can then use the DataAdapter that fills the
strongly typed DataSet call Update() to update the business object. You will
find that some, like Rockford Lhotka prefer more traditional business
objects. If you wish to head this direction, his book is well worth the
read.

UI layer:
Fairly self-explanatory.

Hope this helps as general guidelines.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"pcthug" <pc******@paradise.net.nz> wrote in message
news:zT********************@news02.tsnz.net...
大家好,

我正在使用visual studio .net在vb.net中创建多层应用程序。

我创建了一个invoice.vb类文件,其中包含属性,事件和方法。这个
还有一个订单项集合类(lineitem.vb& lineitems.vb)。我
创建一个表单(form1.frm)并编写相应的代码来初始化
发票对象,表单上有文本框以显示数据,更新和
加载按钮。我的数据存储在访问数据库中。
问:我的对象应该如何与数据库交互?例如。当用户输入所需属性的值等并点击更新(我们已经有发票对象的实例)时,后面的代码调用相应属性的
set方法发票类等。问:这是否应该连接更新数据库,如果
那么如何?



Q我是否还有一个数据对象也是在发票
对象时初始化的,并且在设置属性时传递更新命令?

我希望这对某人有意义!任何帮助都会很酷。

干杯
Hi All,

I am creating multi-tier app in vb.net using visual studio .net.

I create a invoice.vb class file with properties, events and methods. This
also has a line item collection class (lineitem.vb & lineitems.vb). I create a form (form1.frm) and write the corresponding code to initialize an invoice object, there are textboxes on the form to display the data, an update and
load button. My data is stored in an access database.

Q. How should my objects interact with the database? eg. When the user
enters in values for the required properties etc and clicks update (we
already have an instance of the invoice object), the code behind calls the
set method of the corresponding properties in the invoice class etc.
Q. Is this where the connection should be made to update the database, if so how?

or

Q. Should I have a data object also that is initialized when a invoice
object is and update commands are passed through when properties are set?

I hope this makes sense to someone! any help would be cool.

Cheers



很酷,这真的很有趣,也是一个好的开始。你有任何链接到

在线内容,特定于.net的教程。


谢谢堆


Cowboy(Gregory A. Beamer)" <否************ @ comcast.netNoSpamM>写在

消息新闻:e4 ************** @ TK2MSFTNGP10.phx.gbl ...
Cool, this is really interesting and a good start. Do you have any links to
online content, tutorials that are .net specific.

Thanks heaps

"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamM> wrote in
message news:e4**************@TK2MSFTNGP10.phx.gbl...
在大多数情况下,你看下面的内容:

DAL - 数据访问层:
访问数据库的通用层。想法是你可以通过DAL快速切换出数据库。有一个简单的设置方法,您可以使用Microsoft数据访问应用程序块。

注意:其中一个FillDataSet()方法有错误。该行是:
tableName + = tableName +(index + 1).ToString();
应该是:
tableName =" Table" +(index + 1).ToString();

数据层:
如果你使用强类型数据集,这就是你存储它们的地方。

业务层:
业务对象。如果一个人更改数据,您应该有一个脏标志,
或类似,允许您触发更新事件。
这里有两种选择。首先是让类具有CRUD方法。第二个是
辅助类来填充各种业务对象。保罗·谢里夫(Paul Sherriff)也有一个独特的想法,我喜欢这个想法,其业务对象来自DataSet。然后,您可以使用填充
的DataAdapter强类型DataSet调用Update()来更新业务对象。你
会发现一些像罗克福德洛特卡喜欢更传统的商业对象。如果你想领导这个方向,他的书非常值得阅读。

UI层:
相当不言自明。

希望这个帮助作为一般指导。

-
Gregory A. Beamer
MVP; MCP:+ I,SE,SD,DBA

******************************** ****************** ********************
在盒子外面思考! ************************************************* * ********************
pcthug < PC ****** @ paradise.net.nz>在消息中写道
新闻:zT ******************** @ news02.tsnz.net ...
In most scenarios, you see something like the following:

DAL - Data Access Layer:
Generic layer to access the database. Idea is you can quickly switch out
databases by having a DAL. For an easy method of setting this up, you can
use the Microsoft Data Access Application Block.

NOTE: There is an error in one of the FillDataSet() methods. The line is:
tableName += tableName + (index + 1).ToString();
should be:
tableName = "Table" + (index + 1).ToString();

Data Layer:
If you use strongly typed datasets, this is where you store them.

Business Layer:
Business objects. If a person changes data, you should have a dirty flag, or similar, that allows you to fire an update event. There are two options
here. The first is to have the class have CRUD methods. The second is a
helper class to fill the various business objects. There is also a unique
idea from Paul Sherriff, which I happen to like, that has the business
objects derive from DataSet. You can then use the DataAdapter that fills the strongly typed DataSet call Update() to update the business object. You will find that some, like Rockford Lhotka prefer more traditional business
objects. If you wish to head this direction, his book is well worth the
read.

UI layer:
Fairly self-explanatory.

Hope this helps as general guidelines.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"pcthug" <pc******@paradise.net.nz> wrote in message
news:zT********************@news02.tsnz.net...
大家好,

我正在使用visual studio .net在vb.net中创建多层应用程序。

我创建了一个包含属性,事件和方法的invoice.vb类文件。
这也有一个订单项集合类(lineitem.vb& lineitems.vb)。我创建
Hi All,

I am creating multi-tier app in vb.net using visual studio .net.

I create a invoice.vb class file with properties, events and methods. This also has a line item collection class (lineitem.vb & lineitems.vb). I create
一个表单(form1.frm)并编写相应的代码来初始化
a form (form1.frm) and write the corresponding code to initialize an


发票

对象,表单上有文本框显示数据,更新
和加载按钮。我的数据存储在访问数据库中。
问:我的对象应该如何与数据库交互?例如。当用户输入所需属性的值等并点击更新(我们已经有发票对象的实例)时,后面的代码调用
相应属性的set方法发票类等。
问:这是连接应该更新数据库的地方,如果是这样的话,
object, there are textboxes on the form to display the data, an update and load button. My data is stored in an access database.

Q. How should my objects interact with the database? eg. When the user
enters in values for the required properties etc and clicks update (we
already have an instance of the invoice object), the code behind calls the set method of the corresponding properties in the invoice class etc.
Q. Is this where the connection should be made to update the database, if so
如何?

或<问:我是否还有一个数据对象也是在发票
对象时初始化的,并且在属性
how?

or

Q. Should I have a data object also that is initialized when a invoice
object is and update commands are passed through when properties are

时传递更新命令



set?
我希望这对某人有意义!任何帮助都会很酷。

干杯


set?
I hope this makes sense to someone! any help would be cool.

Cheers




如果你喜欢Paul Sherriff方法,这里是网络广播的链接。您将需要安装该软件才能运行它(不是间谍软件,所以没关系),但是

是一个很棒的演示文稿:
http://www.microsoft.com/usa/webcasts /ondemand/1791.asp


此演示文稿显示DAL,数据(强类型数据集)和Business

图层(从DataSet派生) 。您可以从
www.pdsa.com 下载示例代码。


在这个架构中有一些我不太完全确定的东西,但

主要的好处是我可以派人去看这个演示文稿来理解它。

这在可维护性方面相当不错。


微软还有很多最佳实践的电子书
http://msdn.microsoft.com/architecture - 转到模式和实践

部分。


-

Gregory A. Beamer

MVP; MCP:+ I,SE,SD,DBA


**************************** ********************** ********************

在盒子外面思考!

************************************* ************* ********************

" Jodie Rapson" < PC ****** @ paradise.net.nz>在消息中写道

新闻:Wq ******************** @ news02.tsnz.net ...
If you like the Paul Sherriff method, here is a link to a webcast. You will
have to install the software to run it (not spyware, so it is okay), but it
is a great presentation:

http://www.microsoft.com/usa/webcasts/ondemand/1791.asp

This presentation shows the DAL, Data (strongly typed datasets) and Business
layer (derived from DataSet). You can download the sample code from
www.pdsa.com.

There are some things I am not completely sure of in this architecture, but
the main benefit is I can send anyone to this presentation to understand it.
That is worth quite a bit in maintainability.

Microsoft also has plenty of ''best practices'' eBooks at
http://msdn.microsoft.com/architecture - go to the "Patterns and Practices"
section.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"Jodie Rapson" <pc******@paradise.net.nz> wrote in message
news:Wq********************@news02.tsnz.net...
很酷,这真的很有趣,也是一个好的开始。你有任何链接
到在线内容,特定于.net的教程。

谢谢堆

牛仔(Gregory A. Beamer) <否************ @ comcast.netNoSpamM>在消息新闻中写道:e4 ************** @ TK2MSFTNGP10.phx.gbl ...
Cool, this is really interesting and a good start. Do you have any links to online content, tutorials that are .net specific.

Thanks heaps

"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamM> wrote in
message news:e4**************@TK2MSFTNGP10.phx.gbl...
在大多数情况下,你会看到像以下:

DAL - 数据访问层:
访问数据库的通用层。想法是你可以通过DAL快速切换出数据库。为了一个简单的方法来设置它,你可以
In most scenarios, you see something like the following:

DAL - Data Access Layer:
Generic layer to access the database. Idea is you can quickly switch out
databases by having a DAL. For an easy method of setting this up, you can
使用Microsoft数据访问应用程序块。

注意:那里是其中一个FillDataSet()方法中的错误。
行是:tableName + = tableName +(index + 1).ToString();
应该是:
tableName =" Table" +(index + 1).ToString();

数据层:
如果你使用强类型数据集,这就是你存储它们的地方。

业务层:
业务对象。如果一个人更改数据,你应该有一个脏的
标志,
use the Microsoft Data Access Application Block.

NOTE: There is an error in one of the FillDataSet() methods. The line is: tableName += tableName + (index + 1).ToString();
should be:
tableName = "Table" + (index + 1).ToString();

Data Layer:
If you use strongly typed datasets, this is where you store them.

Business Layer:
Business objects. If a person changes data, you should have a dirty flag,
类似,它允许你触发更新事件。
这里有两种选择。首先是让类具有CRUD方法。第二个是
辅助类来填充各种业务对象。还有一个来自Paul Sherriff的
similar, that allows you to fire an update event. There are two options
here. The first is to have the class have CRUD methods. The second is a
helper class to fill the various business objects. There is also a



独特的想法,我喜欢这个想法,其业务对象派生自DataSet。然后,您可以使用填充


unique idea from Paul Sherriff, which I happen to like, that has the business
objects derive from DataSet. You can then use the DataAdapter that fills

的DataAdapter


the

强类型DataSet调用Update()来更新业务对象。你
strongly typed DataSet call Update() to update the business object. You


找到一些像Rockford Lhotka更喜欢更传统的商业对象。如果你想领导这个方向,他的书非常值得阅读。

UI层:
相当不言自明。

希望这个帮助作为一般指导。

-
Gregory A. Beamer
MVP; MCP:+ I,SE,SD,DBA

******************************** ****************** ********************
在盒子外面思考! ************************************************* * ********************
pcthug < PC ****** @ paradise.net.nz>在消息中写道
新闻:zT ******************** @ news02.tsnz.net ...
find that some, like Rockford Lhotka prefer more traditional business
objects. If you wish to head this direction, his book is well worth the
read.

UI layer:
Fairly self-explanatory.

Hope this helps as general guidelines.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"pcthug" <pc******@paradise.net.nz> wrote in message
news:zT********************@news02.tsnz.net...
大家好,

我正在使用visual studio .net在vb.net中创建多层应用程序。

我创建了一个包含属性,事件和方法的invoice.vb类文件。
Hi All,

I am creating multi-tier app in vb.net using visual studio .net.

I create a invoice.vb class file with properties, events and methods.


这也有一个订单项集合类(lineitem.vb& lineitems.vb)。我


This also has a line item collection class (lineitem.vb & lineitems.vb). I


创建

表单(form1.frm)并编写相应的代码来初始化
a form (form1.frm) and write the corresponding code to initialize an


发票

对象,表单上有文本框,用于显示数据,更新和加载按钮。我的数据存储在访问数据库中。
问:我的对象应该如何与数据库交互?例如。当用户输入所需属性的值等并点击更新(我们已经有发票对象的实例)时,后面的代码调用发票类中相应属性的set方法等。问:如果
object, there are textboxes on the form to display the data, an update and load button. My data is stored in an access database.

Q. How should my objects interact with the database? eg. When the user
enters in values for the required properties etc and clicks update (we
already have an instance of the invoice object), the code behind calls the set method of the corresponding properties in the invoice class etc.
Q. Is this where the connection should be made to update the database, if
所以
如何?

或<问:我是否还有一个数据对象,当一个发票
对象被初始化时,当属性
how?

or

Q. Should I have a data object also that is initialized when a invoice
object is and update commands are passed through when properties are


时,会传递更新命令?
我希望这对某人有意义!任何帮助都会很酷。

干杯


set?
I hope this makes sense to someone! any help would be cool.

Cheers




这篇关于我需要真正的帮助!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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