Solved

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

Posted on 2004-09-30
7
1,037 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 7

Expert Comment

by:CleffedUp
ID: 12197070
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
ID: 12197089
0
 
LVL 7

Assisted Solution

by:J_Mak
J_Mak earned 125 total points
ID: 12197395
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_
ID: 21738222
Links in Accepted Answer no longer valid
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

695 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