|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Friday, February 22, 2013 11:14 AM
Points: 39,
Visits: 141
|
|
| How can you get the value of a table COLUMN INDEX.
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 4:08 PM
Points: 38,099,
Visits: 30,392
|
|
Could you be more specific about what you're trying to do?
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Today @ 3:47 PM
Points: 106,
Visits: 290
|
|
Are you trying to do something like this?
Select ROW_NUMBER() OVER(ORDER BY FirstName, LastName) AS RowNumber, FirstName, LastName
Output RowNumber FirstName LastName 1 Joe Smith 2 Joe Thomas 3 Joe Williams
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Friday, February 22, 2013 11:14 AM
Points: 39,
Visits: 141
|
|
I am trying to write a Master/detail code and can't get off to a start on it. I have been working on this this for over a week now. I have already written all the code thats Add,Update,Delete for forms for other areas of this program and all that works well. I am trying to get the data out of each column of all the rows in a datagridview and add it to a lists, and then loop through the list pulling out the column data for each row if i can get this I know how to get it in the database. This is a 3 layer program, and I am using Class Objects. For example I have class (Trips which stores the code for the objects in this table, I have a Class called TripsDB which is dose all the database work.
Any Takers Thanks so much
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 4:08 PM
Points: 38,099,
Visits: 30,392
|
|
Why looping? SQL doesn't need any form of looping to get master-detail information. You'd write a single query with a join across the two tables. Something like this:
SELECT Master.Col1, Master.Col2, Detail.Col1, Detail.Col2, /*more columns*/ FROM Master INNER JOIN Detail on Master.PrimaryKeyColumn = Detail.MasterPrimaryKey
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|