tanmoy Posted March 18, 2006 Posted March 18, 2006 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. Quote
Puiu Posted March 18, 2006 Posted March 18, 2006 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 Quote
Administrators PlausiblyDamp Posted March 18, 2006 Administrators Posted March 18, 2006 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.