Ankur Gupta
Ankur Gupta

Reputation: 11

How to Use dynamic column name in vb.net (with visual studio 2005)

Hi I am creating an attendance system where i want that for a particular id given by user, attendance of that id get saved in the MS access sheet. What i am wanting is that column name should be i date format pre created by me nad as user enters the id the program retrieves date from system and based on that date (taking it to be dynamic column name) writes an p on them. I am using SQL query to update i.e using update statement now i am unable to find correct syntax for using dynamic column name.. So can any one help me??

Upvotes: 1

Views: 622

Answers (1)

Brian Spencer
Brian Spencer

Reputation: 204

If I understand what you are saying... I would change the schema you are envisioning to have a table with "ID" and Date Columns. This prevents you from having a fixed and huge number number of date columns.

You insert a new row in this table for an ID and date combination.

I am also assuming you want a report that pivots the data where you have ID in Column position 0 and dates as column headers? Since you are using Access you can create a Cross Tab Query (pivot) to accomplish this.

Upvotes: 1

Related Questions