为什么要从ADO切换到ADO.NET?(Why switch from ADO to ADO.NET?)
我有一些朋友是“老派”的VB6数据库开发人员,我向他们讲述.NET及其功能,特别是ADO.NET。
在我们的谈话中,他们提出了以下原因,为什么他们宁愿坚持使用ADO而不愿转向ADO.NET:
- 数据集断开(如果电源故障会怎么样?)
- 仍然需要编写相同数量的代码
Dataset
,BindingSource
和TableAdapter
的新选项似乎令人困惑- 编写相同的代码以编程方式访问数据库,所有变化都是如何布置该命令
我正在寻找答案或理由,说明为什么ADO.NET在涉及到Windows Forms应用程序时比ADO在数据访问方面“更好”。 ADO.NET提供的ADO没有提供什么? 它比ADO做得更好吗?
注意:我想要不涉及LINQ的示例。
I have some friends who are 'old-school' VB6 database developers and I was telling them about .NET and its features, specifically ADO.NET.
In our conversation, they brought up the following reasons why they would rather stick with ADO than move to ADO.NET:
- The Dataset is disconnected (What if power fails?)
- The same amount of code still has to be written
- The new options of
Dataset
,BindingSource
andTableAdapter
seem confusing- the same code is written programatically access the Database, all that changes is how that command is laid out
I'm looking for answers or reasons why ADO.NET is 'better' than ADO with regards to data access when it comes to Windows Forms applications. What does ADO.NET provide that ADO does not? What does it do better than ADO?
NB: I'd like examples that do not involve LINQ.
原文:https://stackoverflow.com/questions/1160639
最满意答案
你所描述的是所谓的线性插值 。
对于一般情况,假设在
a
和b
之间有一个值c
,并且需要一个介于0和1之间的值,该值基于c
与a
和b
之间的相对位置。x
的等式如下:x := (c - a) / (b - a)
因此,如果您的值在10到15之间(比如说11),并且您想要一个介于0和1之间的值,则可以将这些值插入上面的公式中:
x := (11 - 10) / (15 - 10) x := 1/5
换句话说,11是从10到15的五分之一。
更为一般的情况(当你在
a
和b
之间有一个值c
,并且你希望y
和z
之间有一个值x
),x
的计算方法如下:x := (c - a) * (z - y) / (b - a) + y
在你的情况下,
z = 1
和y = 0
。What you're describing is called linear interpolation.
For the general case, suppose you have a value
c
betweena
andb
, and you want a valuex
between 0 and 1 which is based onc
's relative position betweena
andb
. The equation forx
is as follows:x := (c - a) / (b - a)
So if you have a value between 10 and 15 (let's say 11), and you want a value between 0 and 1, you punch the values into the equation above:
x := (11 - 10) / (15 - 10) x := 1/5
In other words, 11 is one-fifth of the way from 10 to 15.
The even more general case (when you have a value
c
betweena
andb
and you want a valuex
betweeny
andz
),x
is calculated as follows:x := (c - a) * (z - y) / (b - a) + y
In your case,
z = 1
andy = 0
.
相关问答
更多-
比较3个范围而不是2个(compare 3 ranges instead of 2)[2023-07-14]
Public Function Compare(r1 As Range, r2 As Range, r3 As Range) As Long Dim r As Range, v As Variant, m1 As Variant, m2 As Variant Dim rv As Long rv = 0 For Each r In r1 v = r.Value If v <> 0 And v <> "" And Not IsError(v) Then ... -
保存图像而不重新缩放(Save image without rescaling)[2023-07-25]
要保存图像,您可以使用SciPys imsave功能。 imsave(path, image) 编辑:要将图像另存为bmp ,请相应地选择path的文件扩展名。 编辑2:为了防止强度标准化,你可以使用 scipy.toimage(image, cmin=0, cmax=255, mode='I').save("image.png") 您可以使用mode'I'以特定格式保存图像。 请确保您的输入类型为uint16 。 To save an image you can use SciPys imsave f ... -
将非缩放对象放在单独的组中,然后根据组图层的缩放系数重新缩放(并可选择重新定位)该组。 演示: http : //jsfiddle.net/m1erickson/2X7eK/ var scaleFactor=2; // scale the entire layer by 2X layer.setScale(scaleFactor); // unscale just the noGroup back to original size noGroup.setScale(1/scaleFactor); ...
-
重新缩放范围(rescaling ranges)[2023-10-29]
你所描述的是所谓的线性插值 。 对于一般情况,假设在a和b之间有一个值c ,并且需要一个介于0和1之间的值,该值基于c与a和b之间的相对位置。 x的等式如下: x := (c - a) / (b - a) 因此,如果您的值在10到15之间(比如说11),并且您想要一个介于0和1之间的值,则可以将这些值插入上面的公式中: x := (11 - 10) / (15 - 10) x := 1/5 换句话说,11是从10到15的五分之一。 更为一般的情况(当你在a和b之间有一个值c ,并且你希望y和z之间有一个 ... -
您应该在imageview中使用layout_width =“match_parent”并添加adjustViewBounds =“true”,并让高度为wrap_content。 You should use layout_width="match_parent" and add adjustViewBounds="true" in imageview and let the height to be wrap_content.
-
仿射变换缩放(Affine Transformation Rescaling)[2024-01-20]
恐怕没有办法解决一些简单的数学问题(这也不是那么困难......)! 来自我们的转换矩阵 Chol=L1 L2 0 L3 作为缩放,剪切和旋转的枚举Chol=Sc*Sh*Rot with Sc=Sx 0 , Sh=1 m , Rot= cos(alpha) sin(alpha) 0 Sy 0 1 -sin(alpha) cos(alpha) 与alpha=0如下: L1=Sx , L2=m*Sx , L3=Sy , m=L1/L2. 要使用 ... -
如果您仅定位ipad或您的deployment device是ipad那么您的应用必须支持具有适当用户体验的every ipad 。 根据您的屏幕截图,您的图像未设置为全屏,这是autolayout简单问题。 只需从superview设置四个约束,如top,bottom,leading and trailing ,常量为0 。 而已!! If you targetting ipad only or your deployment device is ipad then your app must suppo ...
-
CSS:如何在Safari上自动重新缩放font-size(CSS: how to do away with automatic rescaling of font-size on Safari)[2023-10-11]
这与你明显使用的字体大小有关,在这个网站上我使用以下css: html, body { font-size: 100%; /* equivalent to 16px */ } 对于影响移动字体的样式表我只为了人们的视力而放置大于16px的尺寸,例如 h2 { font-size:1.5rem; /* notice the use of rem as compared to em - I don't use px for font sizes so I don't know about ... -
假设您的回归是y = W*x + b其中x是缩放数据,原始数据是 y = W/std * x0 + b - u/std * W 其中u和std是平均值和x0标准差。 但我认为你不需要改造数据。 只需使用相同的u和std来缩放新的测试数据。 Suppose your regression is y = W*x + b with x the scaled data, with the original data it is y = W/std * x0 + b - u/std * W where u and ...
-
而不是使用scipy.misc.imread (这只是Pillow的一个[弃用的]前端),请直接使用Pillow。 将索引的Image对象赋予np.array() ,会创建索引数组。 In [101]: from PIL import Image In [102]: img = Image.open('WWpd3.png') In [103]: a = np.array(img) In [104]: a.shape, a.dtype Out[104]: ((160, 320), dtype('uint ...