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