Solved

programatically create table, add columns and assign primary key in VB.net

Posted on 2004-09-30
7
1,031 Views
Last Modified: 2012-06-21
I need to creat a MSAccess table programatically in vb.net

I know how to open a MS Access database using the conenction string
next
I need to creat table ( name = table1)

next I need to add columns programmatically on the fly
Column1, column2  and column2

next I need to assign primary key programatically for a combination of column1 and column2 together ( composite key) programatically on the fly

0
Comment
Question by:KumaraPrathipati
7 Comments
 
LVL 7

Expert Comment

by:CleffedUp
Comment Utility
I don't believe that MS Access supports composite keys.  As for the columns, you should be able to just use T-SQL:

ALTER TABLE myTable (
      ADD Column1 varchar(50),
      ADD Column2 int,
      ADD Column3 date)
0
 
LVL 18

Accepted Solution

by:
DotNetLover_Baan earned 125 total points
Comment Utility
0
 
LVL 7

Assisted Solution

by:J_Mak
J_Mak earned 125 total points
Comment Utility
Have a look at this useful link for creating tables programmatically:

http://www.freevbcode.com/ShowCode.asp?ID=5797

Hope that helps.

0
 

Expert Comment

by:Seamie_
Comment Utility
Links in Accepted Answer no longer valid
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now