473,326 Members | 2,175 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Strange Exception!

Gav
Hi all,

I'm getting an exception that says a column does not exist in a table when
it clearly does.

I'm using DataGridTextBoxColumns in DataGridTableStyle and setting the
correct MappingName, if I click on continue on the exception the program
still works as expected. I tried putting in a field in the MappingName which
I know does not exist and I don't get the exception it just does not show
the column. But I know this field exists it shows the column but i always
get the exception:
System.ArgumentException: Column 'PurID' does not belong to table PURORDERS.
at System.Data.DataRow.CheckColumn(DataColumn column)
at System.Data.DataRowView.GetColumnValue(DataColumn column)
at System.Data.DataColumnPropertyDescriptor.GetValue( Object component)
at
System.Windows.Forms.DataGridColumnStyle.GetColumn ValueAtRow(CurrencyManager
source, Int32 rowNum)
at System.Windows.Forms.DataGridTextBoxColumn.Edit(Cu rrencyManager
source, Int32 rowNum, Rectangle bounds, Boolean readOnly, String
instantText, Boolean cellIsVisible)
at System.Windows.Forms.DataGrid.Edit(String instantText)
at System.Windows.Forms.DataGrid.Edit()
at System.Windows.Forms.DataGrid.OnEnter(EventArgs e)
at System.Windows.Forms.Control.NotifyEnter()
at System.Windows.Forms.ContainerControl.UpdateFocuse dControl()

Has anybody else experienced this?

Thanks
Gav
Aug 31 '05 #1
4 2112
when you created the column in the table, you may have been logged in to the
database as yourself, but when running the app, you are running as a
different identity... perhaps one is the administrator or dbo and the other
is not?

Many folks don't know that SQL Server entity names are composed of three
parts: the database, the owner, and the object. Pubs.dbo.Authors

The problem is that a table is created with the owner of the person who
created it. That said, if it is created with anything other than dbo, then
an application logged in as someone other than you cannot see that table...
which means you can create it again with another owner.

You can have multiple tables with the same name in the same database, each
with different owners. One table could have the column, while the other may
not.

That's my guess. Solution: when creating tables, log in as dbo first, or
create the tables as 'dbo.Authors' instead of 'Authors'.

If you bring up Enterprise Manager, logged in to an account that is mapped
to the 'sa' account on the database, and look, I'll bet the same table is in
there more than once.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Gav" <sp**@spam.com> wrote in message
news:ec**************@TK2MSFTNGP12.phx.gbl...
Hi all,

I'm getting an exception that says a column does not exist in a table when
it clearly does.

I'm using DataGridTextBoxColumns in DataGridTableStyle and setting the
correct MappingName, if I click on continue on the exception the program
still works as expected. I tried putting in a field in the MappingName
which I know does not exist and I don't get the exception it just does not
show the column. But I know this field exists it shows the column but i
always get the exception:
System.ArgumentException: Column 'PurID' does not belong to table
PURORDERS.
at System.Data.DataRow.CheckColumn(DataColumn column)
at System.Data.DataRowView.GetColumnValue(DataColumn column)
at System.Data.DataColumnPropertyDescriptor.GetValue( Object component)
at
System.Windows.Forms.DataGridColumnStyle.GetColumn ValueAtRow(CurrencyManager
source, Int32 rowNum)
at System.Windows.Forms.DataGridTextBoxColumn.Edit(Cu rrencyManager
source, Int32 rowNum, Rectangle bounds, Boolean readOnly, String
instantText, Boolean cellIsVisible)
at System.Windows.Forms.DataGrid.Edit(String instantText)
at System.Windows.Forms.DataGrid.Edit()
at System.Windows.Forms.DataGrid.OnEnter(EventArgs e)
at System.Windows.Forms.Control.NotifyEnter()
at System.Windows.Forms.ContainerControl.UpdateFocuse dControl()

Has anybody else experienced this?

Thanks
Gav

Sep 7 '05 #2
Gav
Thanks for the reply...

I'm not sure how you login to enterprise manager as a different account?

When I go in as normal it says that all the tables are owned by dbo.

Regards
Gav

"Nick Malik [Microsoft]" <ni*******@hotmail.nospam.com> wrote in message
news:cr********************@comcast.com...
when you created the column in the table, you may have been logged in to
the database as yourself, but when running the app, you are running as a
different identity... perhaps one is the administrator or dbo and the
other is not?

Many folks don't know that SQL Server entity names are composed of three
parts: the database, the owner, and the object. Pubs.dbo.Authors

The problem is that a table is created with the owner of the person who
created it. That said, if it is created with anything other than dbo,
then an application logged in as someone other than you cannot see that
table... which means you can create it again with another owner.

You can have multiple tables with the same name in the same database, each
with different owners. One table could have the column, while the other
may not.

That's my guess. Solution: when creating tables, log in as dbo first, or
create the tables as 'dbo.Authors' instead of 'Authors'.

If you bring up Enterprise Manager, logged in to an account that is mapped
to the 'sa' account on the database, and look, I'll bet the same table is
in there more than once.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Gav" <sp**@spam.com> wrote in message
news:ec**************@TK2MSFTNGP12.phx.gbl...
Hi all,

I'm getting an exception that says a column does not exist in a table
when it clearly does.

I'm using DataGridTextBoxColumns in DataGridTableStyle and setting the
correct MappingName, if I click on continue on the exception the program
still works as expected. I tried putting in a field in the MappingName
which I know does not exist and I don't get the exception it just does
not show the column. But I know this field exists it shows the column but
i always get the exception:
System.ArgumentException: Column 'PurID' does not belong to table
PURORDERS.
at System.Data.DataRow.CheckColumn(DataColumn column)
at System.Data.DataRowView.GetColumnValue(DataColumn column)
at System.Data.DataColumnPropertyDescriptor.GetValue( Object component)
at
System.Windows.Forms.DataGridColumnStyle.GetColumn ValueAtRow(CurrencyManager
source, Int32 rowNum)
at System.Windows.Forms.DataGridTextBoxColumn.Edit(Cu rrencyManager
source, Int32 rowNum, Rectangle bounds, Boolean readOnly, String
instantText, Boolean cellIsVisible)
at System.Windows.Forms.DataGrid.Edit(String instantText)
at System.Windows.Forms.DataGrid.Edit()
at System.Windows.Forms.DataGrid.OnEnter(EventArgs e)
at System.Windows.Forms.Control.NotifyEnter()
at System.Windows.Forms.ContainerControl.UpdateFocuse dControl()

Has anybody else experienced this?

Thanks
Gav


Sep 8 '05 #3
"Gav" <sp**@spam.com> wrote in message
news:u7**************@TK2MSFTNGP14.phx.gbl...
Thanks for the reply...

I'm not sure how you login to enterprise manager as a different account?

When I go in as normal it says that all the tables are owned by dbo.

Regards
Gav


Hi Gav,

In SQL EM, register a new connection to the database. Log in as the account
that is mapped to dbo or log in as 'sa'. Another alternative is to make
your account the dbo account.

Only the dbo sees the tables owned by other people.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
Sep 9 '05 #4
Gav
I eventually managed to login as 'sa' but the table in question is only in
there once.

So that rules that out, unfortunatelly.

Thanks for the replys
Gav

"Nick Malik [Microsoft]" <ni*******@hotmail.nospam.com> wrote in message
news:W9********************@comcast.com...
"Gav" <sp**@spam.com> wrote in message
news:u7**************@TK2MSFTNGP14.phx.gbl...
Thanks for the reply...

I'm not sure how you login to enterprise manager as a different account?

When I go in as normal it says that all the tables are owned by dbo.

Regards
Gav


Hi Gav,

In SQL EM, register a new connection to the database. Log in as the
account that is mapped to dbo or log in as 'sa'. Another alternative is
to make your account the dbo account.

Only the dbo sees the tables owned by other people.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--

Sep 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Paul Drummond | last post by:
Hi all, I am developing software for Linux Redhat9 and I have noticed some very strange behaviour when throwing exceptions within a shared library. All our exceptions are derived from...
3
by: nick | last post by:
The program runs well on Local harddisk. But it always popup the exception if I run it on Netware mapping disk. After debugger say there is no source code on the exception. Also the following error...
10
by: John Kraft | last post by:
Hello all, I'm experiencing some, imo, strange behavior with the StreamReader object I am using in the code below. Summary is that I am downloading a file from a website and saving it to disk...
3
by: Anup Daware | last post by:
Hi Group, I am facing a strange problem here: I am trying to read xml response from a servlet using XmlTextWriter. I am able to read the read half of the xml and suddenly an exception:...
13
by: Jen | last post by:
One user of my application is experiencing an exception "input string not in correct format". But it makes no sense where it is occurring. It is occurring when a string from a textbox ("172") is...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.