且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Noobish:搜索没有绑定到对象的mdf数据...

更新时间:2023-10-16 22:10:46

Scott写道:
Scott wrote:

以下是问题(是的,我有问题!哈哈):


使用我自己的数据集的各种变种都让我失望。无论我做什么,我能做到的***的就是行

标题的刺痛,而不是单元格本身的内容。
Here are the issues (yea, I have issues! lol) :

All sorts of variants using my own dataSet are failing me. No matter
what I do, the best I can get it to return is the sting of the Row
header, not the contents of the cells themselves.



好​​的,你已经从样本中展示了代码,但显然那不是代码

你是使用。你能告诉你现在正在尝试什么吗?那肯定会给你
帮助。

OK, you''ve showed the code from a sample, but apparently that''s not the code
you''re using. Can you show what you''re trying now? That''ll definitely
help.


>

我试过这么多我甚至不能再记住它了......

的大脑已煮熟了,是时候休息了,因为我只会向后退货。

我需要做的只是比较

" Command"中所列的所有值。列,以查看它们是否与var匹配。据我所知,这个

***用foreach()接近。
>
I''ve tried so many that I can''t even remember them anymore... the
brain is cooked and it''s time to take a break because I''m only going
backward.
What I need to do is simply compare all the values listed in the
"Command" column to see if they match a var. As far as I know, this
is best approached with a foreach ().



看看DataTable.Select。这很简单:


foreach(DataRow dr in

theTable.Select(string.Format(" Command =''{0} ''',sCom mand)))

{

//所有匹配的行将逐一返回

}

Take a look at DataTable.Select. It''s as easy as:

foreach (DataRow dr in
theTable.Select(string.Format("Command=''{0}''",sCom mand)))
{
// all of the matching rows will be returned one by one
}


>

注意:没有图形化,可点击的方式将数据绑定设置为

特定行因为没有控制来绑定它!如果这里涉及到这样的控制,那么我现在已经很久了。
>
NOTE: There is no graphical, clickable way to set the databinding to a
specific row because there is no control to bind it to!!! If there
were such a control involved here, I''d be long past this point by now.



我的建议:首先学习如何使用低级(er)级别,然后学习
了解数据绑定如何适应图片。它不是灵丹妙药。


HTH


-cd

My recommendation: learn how to use the low(er) level classes first, then
learn how data binding fits into the picture. It''s not a panacea.

HTH

-cd


在Sun,2006年7月30日17:51:17 -0400,Carl Daniel [VC ++ MVP]

< cp ******************* **********@mvps.org.nospamwr ote:
On Sun, 30 Jul 2006 17:51:17 -0400, Carl Daniel [VC++ MVP]
<cp*****************************@mvps.org.nospamwr ote:

我的建议:首先学习如何使用低级(er)级别,

然后学习数据绑定如何适应图片。它不是灵丹妙药..
My recommendation: learn how to use the low(er) level classes first,
then learn how data binding fits into the picture. It''s not a panacea..



哦,我知道。麻烦的是你必须选择一个要关注的区域,否则你会得到太多的信息。我看过DataTable.Select和

开始变得有点旋转,因为我似乎找不到它的方式

适合我的dataSet,bindingSource, bindingNavigator或我的tableAdapeter。


在绝大多数情况下,拖放很容易......在某些方面太简单了。因为当你需要手动完成时,你可能不会知道怎么做。在处理SAPI时,有一些com对象,但是,据我所知,将它们绑定到某些字段并不像使用

文本框那样容易。


我坐在这里以为我应该发布一些代码,但没有什么是

接近功能所以我不知道该发布什么LOL 。这是当前的,

坏了,版本:


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


private void testDbRetrieval()

{

//此字符串是命令中的第一个条目

string sCommands =" Sabine,你在吗?                  。

foreach(DataRow dr in

sabineCommandsDataGridView.Select(string.Format(" C ommand =''{0}''",

sCommands)))


{

// *** BROKEN ***设置字符串resp等于
的值
响应在正确的索引处行...

string resp =

sabineCommandsDataGridView.Select(String.Format(" R esponse =''{0}''") );


//说出给定命令的相应响应

voice.Speak(resp,SpeechVoiceSpeakFlags.SVSFDefault);

}


}


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


感谢您的帮助!我理解TTS没问题,一旦事情变得复杂,各种

上下文需要在树中。我也理解

关于关闭命令应用程序的改编以及为什么需要

来防止降级...这是偶尔的,非常痛苦的简单,

基本面让我背上了我!


Scott

-

使用Opera革命性的电子邮件客户端: http://www.opera.com/ mail /


Scott,

你发布的内容看起来好像你可能会混淆DataGridView >
使用DataTable.Select方法选择方法(选择行),其中
更多是Sql类型的过滤器。声明。卡尔的建议是合适的

恕我直言。

彼得


-

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

UnBlog:
http://petesbloggerama.blogspot.com


" Scott"写道:
Scott,
from what you''ve posted it looks like you may be confusing the DataGridView
Select method(which selects a "Row") with the DataTable.Select method, which
is more of a Sql - type "filter" statement. Carl''s advice was appropriate
IMHO.
Peter

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


"Scott" wrote:

On Sun,2006年7月30日17:51:17 -0400,Carl Daniel [VC ++ MVP]

< cp * ****************************@mvps.org.nospamwr ote:
On Sun, 30 Jul 2006 17:51:17 -0400, Carl Daniel [VC++ MVP]
<cp*****************************@mvps.org.nospamwr ote:

我的建议:首先学习如何使用低级(呃)级别,然后学习数据绑定如何适应图片。它不是灵丹妙药..
My recommendation: learn how to use the low(er) level classes first,
then learn how data binding fits into the picture. It''s not a panacea..



哦,我知道。麻烦的是你必须选择一个要关注的区域,否则你会得到太多的信息。我看过DataTable.Select和

开始变得有点旋转,因为我似乎找不到它的方式

适合我的dataSet,bindingSource, bindingNavigator或我的tableAdapeter。


在绝大多数情况下,拖放很容易......在某些方面太简单了。因为当你需要手动完成时,你可能不会知道怎么做。在处理SAPI时,有一些com对象,但是,据我所知,将它们绑定到某些字段并不像使用

文本框那样容易。


我坐在这里以为我应该发布一些代码,但没有什么是

接近功能所以我不知道该发布什么LOL 。这是当前的,

坏了,版本:


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


private void testDbRetrieval()

{

//此字符串是命令中的第一个条目

string sCommands =" Sabine,你在吗?                  。

foreach(DataRow dr in

sabineCommandsDataGridView.Select(string.Format(" C ommand =''{0}''",

sCommands)))


{

// *** BROKEN ***设置字符串resp等于
的值
响应在正确的索引处行...

string resp =

sabineCommandsDataGridView.Select(String.Format(" R esponse =''{0}''") );


//说出给定命令的相应响应

voice.Speak(resp,SpeechVoiceSpeakFlags.SVSFDefault);

}


}


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


感谢您的帮助!我理解TTS没问题,一旦事情变得复杂,各种

上下文需要在树中。我也理解

关于关闭命令应用程序的改编以及为什么需要

来防止降级...这是偶尔的,非常痛苦的简单,

基本面让我背上了我!


Scott


-

使用Opera革命性的电子邮件客户端: http:// www。 opera.com/mail/