1.11M Members

Creating Database Dynamically

 
0
 

I want to create tables in database dynamically i.e at the click event of a button or any other event.
Suggest me HOW ?

Thank You

 
0
 

Look at the sql statements in this tutorial

 
0
 

Below example is in MS SQL...same can be done in Access database just change the SQLCommant to OLEDBCommand

First open the connection and then

Dim myCommand As SqlCommand
myCommand = New SqlCommand("CREATE TABLE Tablename (col1 datatype1,col2 datatype2)", myconn) 'where myconn is the connection object
myCommand.ExecuteNonQuery()

'Keep adding the table names as many as u want
myCommand = New SqlCommand("CREATE TABLE Tablename2 (col1 datatype1,col2 datatype2)", myconn) 'where myconn is the connection object
myCommand.ExecuteNonQuery() 

.
.
.
.

CLose the connection

 
0
 

@poojavb:

In Fact I wanted to add table at the click event of the mouse which will take the table name from the user. And I have solved it.

I Appreciate your help.
Thanks a Lot.

Question Answered as of 1 Year Ago by Ancient Dragon and poojavb
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article