Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / June 2004

Tip: Looking for answers? Try searching our database.

Identity and primary keys

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rguti - 10 Jun 2004 19:18 GMT
I'm looping thru all the columns in a dataset that was filled from a SQL
Server table. I want to be able to exclude the columns that have an identity
key or are primary keys in SQL Server. Is there any method or property for
this in the dataset? or how do you go about getting that information for
each column?

Thanks
Cowboy \(Gregory A. Beamer\) [MVP] - 10 Jun 2004 20:28 GMT
You can query the master database tables to figure out which are keys, but
there is nothing you can do in ADO.NET or your .NET code to automagically
remove primary keys and identity fields.

Signature

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************

> I'm looping thru all the columns in a dataset that was filled from a SQL
> Server table. I want to be able to exclude the columns that have an identity
[quoted text clipped - 3 lines]
>
> Thanks
William Ryan eMVP - 10 Jun 2004 20:46 GMT
Why are you including them in the query then?  If you are pulling the stuff
over just to remove it, it's a waste every way around.

Signature

W.G. Ryan, eMVP

http://forums.devbuzz.com/
http://www.knowdotnet.com/williamryan.html
http://www.msmvps.com/WilliamRyan/

> I'm looping thru all the columns in a dataset that was filled from a SQL
> Server table. I want to be able to exclude the columns that have an identity
[quoted text clipped - 3 lines]
>
> Thanks
rguti - 10 Jun 2004 21:02 GMT
It was just as an example, I just need to know extra information about each
column as compared to the field in the table.

> Why are you including them in the query then?  If you are pulling the stuff
> over just to remove it, it's a waste every way around.
[quoted text clipped - 14 lines]
> >
> > Thanks
William Ryan eMVP - 10 Jun 2004 21:38 GMT
Cool, but what  do you want to delete it for?  Are you including it just so
you can get that information?  You can get that info from
Information_Schema.Columns if you're using Sqlserver

Signature

W.G. Ryan, eMVP

http://forums.devbuzz.com/
http://www.knowdotnet.com/williamryan.html
http://www.msmvps.com/WilliamRyan/

> It was just as an example, I just need to know extra information about each
> column as compared to the field in the table.
[quoted text clipped - 19 lines]
> > >
> > > Thanks

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.