数据集查找问题 [英] Dataset Find Problem

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

问题描述




运行以下

代码时,我得到''System.Data.MissingPrimaryKeyException'': -

StockListDataSet.Tables(" Items")。Rows.Find(" 12345")


有什么方法吗?我需要提供更多信息吗?


谢谢。

Hi,

I get a ''System.Data.MissingPrimaryKeyException'' when running the follwing
code:-
StockListDataSet.Tables("Items").Rows.Find("12345" )

Is there any way around this? Do I need to supply more information?

Thanks.

推荐答案

你有一个Key定义了吗?项目表?此外,由于您使用的是

StronglyTyped数据集, - 不确定您是否要使用

" Items" ...如果表名更改为某些原因 - 在你收到错误的编译时间之前你不会发现

...


-

WG Ryan MVP(Windows Embedded)

TiBA解决方案
www .tibasolutions.com | www.devbuzz.com | www.knowdotnet.com

" Martin Horn" <毫安**** @ mhorn.co.uk>在消息中写道

news:6f ***************** @ newsfe1-gui.ntli.net ...
do you have a Key defined on the Items table? Also, since you''re using a
StronglyTyped DataSet, - not sure you want to referencethe table with
"Items"... if the table name changes for some reason - you wont find out
until compile time when you get an error...

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Martin Horn" <ma****@mhorn.co.uk> wrote in message
news:6f*****************@newsfe1-gui.ntli.net...


运行
后续代码时,我收到''System.Data.MissingPrimaryKeyException'': -
StockListDataSet.Tables(" Items")。Rows.Find (12345)

有什么方法吗?我是否需要提供更多信息?

谢谢。
Hi,

I get a ''System.Data.MissingPrimaryKeyException'' when running the follwing code:-
StockListDataSet.Tables("Items").Rows.Find("12345" )

Is there any way around this? Do I need to supply more information?

Thanks.



您是否在项目上定义了密钥?表?此外,由于您使用的是

StronglyTyped数据集, - 不确定您是否要使用

" Items" ...如果表名更改为某些原因 - 在你收到错误的编译时间之前你不会发现

...


-

WG Ryan MVP(Windows Embedded)

TiBA解决方案
www .tibasolutions.com | www.devbuzz.com | www.knowdotnet.com

" Martin Horn" <毫安**** @ mhorn.co.uk>在消息中写道

news:6f ***************** @ newsfe1-gui.ntli.net ...
do you have a Key defined on the Items table? Also, since you''re using a
StronglyTyped DataSet, - not sure you want to referencethe table with
"Items"... if the table name changes for some reason - you wont find out
until compile time when you get an error...

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Martin Horn" <ma****@mhorn.co.uk> wrote in message
news:6f*****************@newsfe1-gui.ntli.net...


运行
后续代码时,我收到''System.Data.MissingPrimaryKeyException'': -
StockListDataSet.Tables(" Items")。Rows.Find (12345)

有什么方法吗?我是否需要提供更多信息?

谢谢。
Hi,

I get a ''System.Data.MissingPrimaryKeyException'' when running the follwing code:-
StockListDataSet.Tables("Items").Rows.Find("12345" )

Is there any way around this? Do I need to supply more information?

Thanks.



您需要设置主键你的数据表可以找到工作。


" Martin Horn" <毫安**** @ mhorn.co.uk>在消息中写道

news:6f ***************** @ newsfe1-gui.ntli.net ...
you need to set up a primary key on your data table for the find to work.

"Martin Horn" <ma****@mhorn.co.uk> wrote in message
news:6f*****************@newsfe1-gui.ntli.net...


运行
后续代码时,我得到''System.Data.MissingPrimaryKeyException'': -
StockListDataSet.Tables(" Items")。Rows.Find (12345)

有什么方法吗?我需要提供更多信息吗?

谢谢。
Hi,

I get a ''System.Data.MissingPrimaryKeyException'' when running the
follwing code:-
StockListDataSet.Tables("Items").Rows.Find("12345" )

Is there any way around this? Do I need to supply more information?

Thanks.



这篇关于数据集查找问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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