ADO C#VB的区别 [英] ADO C# VB Difference

查看:59
本文介绍了ADO C#VB的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在vb我们说....


Dim theRow as dsLogin.CustLoginRow

theRow = DsLogin1.CustLogin.Rows(0)


如果我试着在C#中说出以下内容,我说我不能做一个隐含的

转换...


dsLogin.CustLoginRow theRow;

theRow = dsLogin1.CustLogin.Rows [0];


所以我不得不说......


dsLogin.CustLoginRow theRow;

theRow =(dsLogin.CustLoginRow)dsLogin1.CustLogin.Rows [0];


,这是非常罗嗦的。有没有更好的方式在C#中说这个?


再次感谢(抱歉这么多问题)

T

解决方案

没有。这就是这样做的方式。

-


干杯,

Gaurav
http://www.edujini.in

------ -------------

Tina < TI ********** @ nospammeexcite.com>在留言中写道

news:ez **************** @ TK2MSFTNGP05.phx.gbl ...

在vb中我们说....

Dim theRow as dsLogin.CustLoginRow
theRow = DsLogin1.CustLogin.Rows(0)

如果我试着在C#中说出以下内容它说我不能进行隐含的转换......

dsLogin.CustLoginRow theRow;
theRow = dsLogin1.CustLogin.Rows [0];

所以我不得不说......

dsLogin.CustLoginRow theRow;
theRow =(dsLogin.CustLoginRow)dsLogin1.CustLogin.Rows [0];
再次感谢(抱歉这么多问题)



我想你可以刮掉一条线:


dsLogin.CustLoginRow theRow =(dsLogin.CustLoginRow)

dsLogin1.CustLogin。行[0];


实际上,如果您认为C#是Wordy,请尝试计算用VB编写的整个类中的字符数

.NET,然后是C#中的同一个。大多数的时间,C#更紧凑。它当然更优雅,虽然

课程只是我的意见。


彼得


-

联合创始人,Eggheadcafe.com开发者门户网站:
http: //www.eggheadcafe.com

UnBlog:
http://petesbloggerama.blogspot.com


" Tina"写道:

在vb我们说....

Dim theRow as dsLogin.CustLoginRow
theRow = DsLogin1.CustLogin.Rows(0)

如果我试着在C#中说出以下内容,我说我不能做一个隐含的转换......

dsLogin.CustLoginRow theRow;
theRow = dsLogin1.CustLogin.Rows [0];

所以我不得不说......

dsLogin.CustLoginRow theRow;
theRow =(dsLogin.CustLoginRow)dsLogin1.CustLogin.Rows [0];

这是非常罗嗦的。有没有更好的方式在C#中说这个?

再次感谢(抱歉这么多问题)



感谢。那个好一点。


关于你对C#的偏好....


恕我直言,我从未见过两种语言彼此相提并论。

很大的错误是它们都存在,因此存在这种差异

的事情。微软应该翻转一枚硬币并将其中的任何一个放在其中任何一个上面。


T



" Peter Bromberg [C#MVP]" < PB ******* @ yahoo.nospammin.com>在消息中写道

新闻:E9 ********************************** @ microsof t.com ...

我想你可以剃掉一条线:

dsLogin.CustLoginRow theRow =(dsLogin.CustLoginRow)
dsLogin1.CustLogin.Rows [0];

实际上,如果您认为C#是Wordy,请尝试计算用VB.NET编写的整个类中的
字符数,然后在C#中也是一样的。大多数时间,C#更紧凑。它当然更优雅,但当然只是我的意见。

彼得

-
联合创始人,Eggheadcafe.com开发人员门户网站:
http://www.eggheadcafe.com
UnBlog :
http://petesbloggerama.blogspot.com


蒂娜写道:

在vb我们说....

Dim theRow as dsLogin.CustLoginRow
theRow = DsLogin1.CustLogin.Rows(0)

如果我试着在C#中说出以下内容,我说我不能做一个隐含的转换......

dsLogin.CustLoginRow theRow;
theRow = dsLogin1.CustLogin.Rows [0];

所以我不得不说......

dsLogin.CustLoginRow theRow;
theRow =(dsLogin.CustLoginRow)dsLogin1.CustLogin.Rows [0];

这是非常罗嗦的。有没有更好的方式在C#中说这个?

再次感谢(对很多问题感到抱歉)



In vb we say....

Dim theRow As dsLogin.CustLoginRow
theRow = DsLogin1.CustLogin.Rows(0)

If I try to say the following in C# it says I can''t do an implicit
conversion...

dsLogin.CustLoginRow theRow;
theRow = dsLogin1.CustLogin.Rows[0];

So I had to say......

dsLogin.CustLoginRow theRow;
theRow = (dsLogin.CustLoginRow) dsLogin1.CustLogin.Rows[0];

that''s pretty wordy. Is there a better way to say this in C#?

Thanks again (and sorry for so many quesions)
T

解决方案

No. That''s the way to do it.
--

Cheers,
Gaurav
http://www.edujini.in
-------------------
"Tina" <ti**********@nospammeexcite.com> wrote in message
news:ez****************@TK2MSFTNGP05.phx.gbl...

In vb we say....

Dim theRow As dsLogin.CustLoginRow
theRow = DsLogin1.CustLogin.Rows(0)

If I try to say the following in C# it says I can''t do an implicit
conversion...

dsLogin.CustLoginRow theRow;
theRow = dsLogin1.CustLogin.Rows[0];

So I had to say......

dsLogin.CustLoginRow theRow;
theRow = (dsLogin.CustLoginRow) dsLogin1.CustLogin.Rows[0];

that''s pretty wordy. Is there a better way to say this in C#?

Thanks again (and sorry for so many quesions)
T



I suppose you could shave off a line:

dsLogin.CustLoginRow theRow= (dsLogin.CustLoginRow)
dsLogin1.CustLogin.Rows[0];

Actually, if you think C# is "Wordy", try counting the number of characters
in an entire Class written in VB.NET and then the same one in C#. Most of the
time, C# is more compact. It certainly is more elegant, although that of
course is just my opinion.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Tina" wrote:

In vb we say....

Dim theRow As dsLogin.CustLoginRow
theRow = DsLogin1.CustLogin.Rows(0)

If I try to say the following in C# it says I can''t do an implicit
conversion...

dsLogin.CustLoginRow theRow;
theRow = dsLogin1.CustLogin.Rows[0];

So I had to say......

dsLogin.CustLoginRow theRow;
theRow = (dsLogin.CustLoginRow) dsLogin1.CustLogin.Rows[0];

that''s pretty wordy. Is there a better way to say this in C#?

Thanks again (and sorry for so many quesions)
T



Thanks. That''s a little better.

Regarding your preference for C#....

IMHO, I have never seen two languages more on par with each other. The
great mistake is that they both exist and therefore there is this difference
thing. Microsoft should have flipped a coin and just put all of there
resources on either one of them.

T


"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:E9**********************************@microsof t.com...

I suppose you could shave off a line:

dsLogin.CustLoginRow theRow= (dsLogin.CustLoginRow)
dsLogin1.CustLogin.Rows[0];

Actually, if you think C# is "Wordy", try counting the number of
characters
in an entire Class written in VB.NET and then the same one in C#. Most of
the
time, C# is more compact. It certainly is more elegant, although that of
course is just my opinion.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Tina" wrote:

In vb we say....

Dim theRow As dsLogin.CustLoginRow
theRow = DsLogin1.CustLogin.Rows(0)

If I try to say the following in C# it says I can''t do an implicit
conversion...

dsLogin.CustLoginRow theRow;
theRow = dsLogin1.CustLogin.Rows[0];

So I had to say......

dsLogin.CustLoginRow theRow;
theRow = (dsLogin.CustLoginRow) dsLogin1.CustLogin.Rows[0];

that''s pretty wordy. Is there a better way to say this in C#?

Thanks again (and sorry for so many quesions)
T



这篇关于ADO C#VB的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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