I have a function that reads thru an array that looks like the first array below in order to look for each input name on a ASP form. The question is, is there a better way than the bulky crap below to select a table with it's column names in this format.
Thanks!
-Coolhand2120
Example of desired output (array 2D comma and crlf delemeted):
ContactID,{D31CCA6F-0A2B-44B2-AD45-F3B2B713AE52}
FirstName,Bob
LastName,Rogers
Addresss,12345 E 4th St.
etc...
Rather than (what you'd get with getrows())
{D31CCA6F-0A2B-44B2-AD45-F3B2B713AE52},0
Bob,0
Rogers,0
12345 E 4th St.,0
Bulky thing I'm using now
ALTER PROCEDURE contactArray (@contactID as uniqueidentifier)
AS
select 'ContactID', (select contactID from contacts where contactID = @contactID)
union all
select 'FirstName',(select FirstName from contacts where contactID = @contactID)
union all
select 'LastName',(select LastName from contacts where contactID = @contactID)
union all
select 'Address1',(select Address1 from contacts where contactID = @contactID)
union all
select 'Address2',(select Address1 from contacts where contactID = @contactID)
union all
select 'City',(select City from contacts where contactID = @contactID)
union all
select 'State',(select State from contacts where contactID = @contactID)
union all
select 'ZIP',(select ZIP from contacts where contactID = @contactID)
union all
select 'Country',(select Country from contacts where contactID = @contactID)
union all
select 'HomePhone',(select HomePhone from contacts where contactID = @contactID)
union all
select 'WorkPhone',(select WorkPhone from contacts where contactID = @contactID)
union all
select 'Email',(select Email from contacts where contactID = @contactID)
union all
select 'SpecialInstructions',(select SpecialInstructions from contacts where contactID = @contactID)
union all
select 'Comments',(select Comments from contacts where contactID = @contactID)
by: lluthienPosted on 2006-01-17 at 01:19:27ID: 15718035
isn't it possible to do this in ASP, rather than sql?
- create an asp array
- retrieve the records in a recordset,
- loop the records
- for each record, insert the name of the column into column one of the array and the value in column two.