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

Recommended Answers

All 2 Replies

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.