重新发布:错误消息 [英] Repost: Error message

查看:76
本文介绍了重新发布:错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从Access收集信息的程序。我正在尝试使用

以下select命令从Families

表中选择所有信息并将其存储在数据集中,再加入Surname和FirstName字段

创建一个新字段,FamilyName:


selFamilies.CommandText =" SELECT Families。*,Families.Surname +'',' '+

Families.FirstName AS FamilyName FROM Families ORDER BY Surname,FirstName"


直到最近,它已经完美地工作了很多次,现在

当我尝试运行该程序时,它停在这一行:


adpFamilies.Fill(datSPARK," Families")


并给我这个错误消息:


"'System.InvalidOperationException'类型未处理的异常

在系统中.data.dll

附加信息:当读者关闭
时,对NextResult的尝试无效。


I''mn对于整个数据库的事情,这条消息对我来说是希腊语。如果我使用这个简单的选择命令代替:


selFamilies.CommandText =" SELECT * FROM Families ORDER BY Surname,

FirstName


程序没有给我错误。


我真的很感激任何人都可以给我的帮助。


谢谢

Carolyn

解决方案




试试这个。


selFamilies.CommandText =" SELECT Families。*,(Families.Surname +'',''+

Families.FirstName)AS FamilyName FROM Families ORDER BY Surname,FirstName


Ken

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

" Carolyn" <所以***** @ newsgroups.microsoft.com>在消息中写道

news:e%**************** @ TK2MSFTNGP11.phx.gbl ...

我'有一个程序从Access收集信息。我正在尝试使用
以下select命令从Families表中选择所有信息并将其存储在数据集中,并加入Surname和FirstName
字段到创建一个新字段,FamilyName:

selFamilies.CommandText =" SELECT Families。*,Families.Surname +'',''+
Families.FirstName AS FamilyName FROM Families ORDER BY Surname ,
FirstName"
直到最近,这已经完成了很多次,现在当我尝试运行程序时,它停在这条线上:
adpFamilies.Fill(datSPARK,Families)

并给我这个错误消息:

"类型''System.InvalidOperationException''的未处理异常b $ b发生在system.data.dll
附加信息:读取器关闭时对NextResult的尝试无效。

我是整个数据库的新手,这条消息对我来说是希腊语。如果
我改为使用这个简单的select命令:

selFamilies.CommandText =" SELECT * FROM Families ORDER BY Surname,
FirstName"

程序没有给我错误。

我真的很感激任何人都可以给我的帮助。

谢谢
Carolyn





试试这个。


selFamilies.CommandText =" ; SELECT Families。*,(Families.Surname +'',''+

Families.FirstName)AS FamilyName FROM Families ORDER BY Surname,FirstName


Ken

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

" Carolyn" <所以***** @ newsgroups.microsoft.com>在消息中写道

news:e%**************** @ TK2MSFTNGP11.phx.gbl ...

我'有一个程序从Access收集信息。我正在尝试使用
以下select命令从Families表中选择所有信息并将其存储在数据集中,并加入Surname和FirstName
字段到创建一个新字段,FamilyName:

selFamilies.CommandText =" SELECT Families。*,Families.Surname +'',''+
Families.FirstName AS FamilyName FROM Families ORDER BY Surname ,
FirstName"
直到最近,这已经完成了很多次,现在当我尝试运行程序时,它停在这条线上:
adpFamilies.Fill(datSPARK,Families)

并给我这个错误消息:

"类型''System.InvalidOperationException''的未处理异常b $ b发生在system.data.dll
附加信息:读取器关闭时对NextResult的尝试无效。

我是整个数据库的新手,这条消息对我来说是希腊语。如果
我改为使用这个简单的select命令:

selFamilies.CommandText =" SELECT * FROM Families ORDER BY Surname,
FirstName"

程序没有给我错误。

我真的很感激任何人都可以给我的帮助。

谢谢
Carolyn


试试这个


试试


selFamilies.CommandText =" SELECT Families.Surname,Families.Surname FROM

人们订购家庭姓氏,家庭。姓氏


Catch ex as Exception

MessageBox.Show(ex.ToString())


结束尝试


希望这个修改过的Commandtext可以解决问题,如果不是这样的话,

将收到更多详细信息的错误消息。

问候OHM


I''ve got a program that collects info from an Access. I''m trying to use the
following select command to select all the information from the "Families"
table and store it in a dataset, plus join the Surname and FirstName fields
to create a new field, FamilyName:

selFamilies.CommandText = "SELECT Families.*, Families.Surname + '', '' +
Families.FirstName AS FamilyName FROM Families ORDER BY Surname, FirstName"

This has been working perfectly a number of times until recently, and now
when I try to run the program, it stops on this line:

adpFamilies.Fill(datSPARK, "Families")

and gives me this error message:

"An unhandled exception of type ''System.InvalidOperationException'' occurred
in system.data.dll
Additional information: Invalid attempt to NextResult when reader is
closed."

I''m new to the whole database thing, and this message is Greek to me. If I
use this simple select command instead:

selFamilies.CommandText = "SELECT * FROM Families ORDER BY Surname,
FirstName"

the program doesn''t give me the error.

I would really appreciate any help anyone can give me.

Thanks
Carolyn

解决方案

Hi,

Try this.

selFamilies.CommandText = "SELECT Families.*, (Families.Surname + '', '' +
Families.FirstName) AS FamilyName FROM Families ORDER BY Surname, FirstName

Ken
-----------------
"Carolyn" <so*****@newsgroups.microsoft.com> wrote in message
news:e%****************@TK2MSFTNGP11.phx.gbl...

I''ve got a program that collects info from an Access. I''m trying to use the following select command to select all the information from the "Families"
table and store it in a dataset, plus join the Surname and FirstName fields to create a new field, FamilyName:

selFamilies.CommandText = "SELECT Families.*, Families.Surname + '', '' +
Families.FirstName AS FamilyName FROM Families ORDER BY Surname, FirstName"
This has been working perfectly a number of times until recently, and now
when I try to run the program, it stops on this line:

adpFamilies.Fill(datSPARK, "Families")

and gives me this error message:

"An unhandled exception of type ''System.InvalidOperationException'' occurred in system.data.dll
Additional information: Invalid attempt to NextResult when reader is
closed."

I''m new to the whole database thing, and this message is Greek to me. If I use this simple select command instead:

selFamilies.CommandText = "SELECT * FROM Families ORDER BY Surname,
FirstName"

the program doesn''t give me the error.

I would really appreciate any help anyone can give me.

Thanks
Carolyn



Hi,

Try this.

selFamilies.CommandText = "SELECT Families.*, (Families.Surname + '', '' +
Families.FirstName) AS FamilyName FROM Families ORDER BY Surname, FirstName

Ken
-----------------
"Carolyn" <so*****@newsgroups.microsoft.com> wrote in message
news:e%****************@TK2MSFTNGP11.phx.gbl...

I''ve got a program that collects info from an Access. I''m trying to use the following select command to select all the information from the "Families"
table and store it in a dataset, plus join the Surname and FirstName fields to create a new field, FamilyName:

selFamilies.CommandText = "SELECT Families.*, Families.Surname + '', '' +
Families.FirstName AS FamilyName FROM Families ORDER BY Surname, FirstName"
This has been working perfectly a number of times until recently, and now
when I try to run the program, it stops on this line:

adpFamilies.Fill(datSPARK, "Families")

and gives me this error message:

"An unhandled exception of type ''System.InvalidOperationException'' occurred in system.data.dll
Additional information: Invalid attempt to NextResult when reader is
closed."

I''m new to the whole database thing, and this message is Greek to me. If I use this simple select command instead:

selFamilies.CommandText = "SELECT * FROM Families ORDER BY Surname,
FirstName"

the program doesn''t give me the error.

I would really appreciate any help anyone can give me.

Thanks
Carolyn



Try this

Try

selFamilies.CommandText ="SELECT Families.Surname, Families.Surname FROM
People ORDER BY Families.Surname, Families.Surname"

Catch ex as Exception

MessageBox.Show(ex.ToString())

End try

Hopefully this amended Commandtext will do the trick, if not at least you
will get an error message with a bit more detail.
Regards OHM


这篇关于重新发布:错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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