all groups > dotnet ado.net > april 2008 >
You're in the

dotnet ado.net

group:

Underscore ("_") prefix added to my Column Name


Underscore ("_") prefix added to my Column Name r0bb1e
4/23/2008 11:01:01 PM
dotnet ado.net: I manually created a DataTable in a Typed DataSet using the DataSet designer
in VS 2008 Pro. One of the Column names is "IN". When referencing this
table in VB.Net 2008, the IntelliSense did not show the column "IN" but it
did show a column "_IN'. If I tried to reference this column in code using
"tablenameRow.IN" I got the build error: "'IN' is not a member of
'app.DataSet.tableRow". If I reference it with "tablenameRow._IN" then I
don't get the build error. I have several other 2-letter-capitalized column
names in this table such as: "'LT', 'PI' and 'MA'". These other column names
show up in intellisense and can be referenced without the "_" prefix.

Can someone tell me what's going on?

Thanks
--
Robert Scarborough
Re: Underscore ("_") prefix added to my Column Name Miha Markic
4/24/2008 9:49:08 AM
IN is a sql keyword....

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

[quoted text, click to view]
Re: Underscore ("_") prefix added to my Column Name r0bb1e
4/24/2008 10:11:02 AM
T thought of that, so for a test I created a Column named "FROM'. This did
not cause a column named "_FROM" to be created. And referencing
"tablenameRow.From" caused no build errors. Furthermore, Intellisense showed
the column "From" in the list of properties/columns for the DataTable Row.
(Although it didn't show up as all capitals in Intellisense and when I put
"tablenameRow.FROM" in my code, Visual Studio changed it to
"tablenameRow.From".

So why does the system treat "FROM" different from "IN"? They're both SQL
reserverd words.

--
Robert Scarborough
Integrated Visual Systems


[quoted text, click to view]
AddThis Social Bookmark Button