Is there a better way to do that textbox-array <--> DB thing?

  • what I have right now is a form with about 1 to 300 little textbox that accept number (0 to 9) and sometime a "." to flag that textbox to exclude it from a formula 

    max length of the textbox is 1

    the user can enter from 1 to 300 value with or without the flag.

    in the database(SQL 2005) right now it's stored in a varchar(900) and it look like

    'V4V8V.9V7V5V.1V8V9' (and it can continue until the maximum of 300 is reach) 

    1 important thing, it must keep the same order when it's loaded/saved

    you can now see that it's use a concatenation and I would like to know another good way to do that and I cannot use a XML field and the "." character can change

    the DB right now look like:

    cellID integer (key)

    cellValue varchar(900)




  • What type of information are you storing ? What does the 300 values represent?

  • number of person in a vehicle 

  • Sounds like a data model problem to me.  I'd rethink the way you are storing the info in the database. Something like the following.


    Id int,

    VehicleTypeId int,

    NoOfPassengers int,

    IncludeInCalculation bit


    With some alteration depending on the what it relates to.  Then you can stream the entire rowset into a grid which would make things a hell of a lot easier.


  •  that application will soon be redesigned from scratch and the database too (i wish it would be like tomorrow)

     thanks for the idea

  • Wow. This sounds like front page material right here.

    Post as much code as you can... We could use a good one on the front page this week.

Log in to reply

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.