954,092 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how to create a sql table through coding in vb.net

can anyone tell me the coding for creating a sql table programatically in vb.net

rinkuchoudhury
Newbie Poster
16 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 

Firstly I would have to ask why? Generally the only need to create tables on the fly are for imports of XML or spreadsheet data, or assembling distributed data for report output . Stuff like that, in which case I would call a stored procedure from VB using the usual ADO connection and command objects, in the stored procedure I would use T-SQL to create a temporary table and do the business there.
Can you give more background?

T-SQL for creating a table is

create table #mytemptbl
(
id int,
data varchar(50)
)

The table exists for the life of the connection and is only available to that connection, if you prefix with two gates ##mytemptbl it is available globaly to all connections to the database.

If you are wanting to create a databse schema as part of an install of a VB app you have made then again script the tables and procedures in T-SQL and simple put the script as the CommandText property of an ADO command object connect and execute it against the database.

hollystyles
Veteran Poster
1,182 posts since Feb 2005
Reputation Points: 262
Solved Threads: 68
 

hi
thanks 4 the nice suggesion
actually I want to convert a xml data to sql table and show the data from sql dataset through a gridviw
regarding this I have to create a sql table programatically and have to add the xml table there

I have sent a thread regarding this also
but still now had not get any appropreate reply


can u help me regarding this

eagerly waiting 4 reply

Thanks & Regards
Tapas

rinkuchoudhury
Newbie Poster
16 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: