Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
hello sir.i am beginner in vb.net.i have a problem.i have a table name "trans".i want to add column in this table dynamicaly and also remove column dynamically.the column name will be given by d user.and i also tell the column number.suppose in my "trans" table there are three columns.the column names are "cake","pastry","totalquan".now i want to add a column name biscuit after the pastry column.how can i do this? this is my problem.please help me.my programe is write in vb.net and my database is in ms.access.help me please.
Posted

The syntax for the query should be "Alter table trans add biscuit <type of value here>"

You shouldn't worry about the order of the columns because you can arrange them when you make the select clause: "Select cake, pastry, biscuit, totalquan from trans"

 

If you want to drop a column: "Alter table trans drop column biscuit"

That should do it

  • Administrators
Posted

Just out of interest is there areason why you need to be able to add / remove columns dynamically?

 

Although technically possible (as Puiu explained above) it is most definately not a normal way for a database to be maintained. If you gave a bit more detail about what you are trying to achieve then there may be a better alternative.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...