chaangeable sql statements

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am going to write an visual studio.net 1.1 application where I would like
to setup dynamic sql statements.
Basically I am going to have a sql server 2000 control table where users
can select via a web page, what columns they want to see with their own
unique (personal) sql server 2000. The control table will be setup to show
what columns
users want to display on their own individual sql server 2000 tables.
Thus basically if a user selects that they want to create a table with
columns #1, #9 and #16 from an option control table, I am wondering if there
a way to string together dynamic sql statements. These dynamic statements
would occur when a table is created and you insert rows into the table.

Thanks!
 
Sounds like a security nightmare but given that an Sql statement is just a
string then some simple string concantenation will allow dynamic generation
of table schema.

RR
 
Wendy,

In addition to Roger, this seems to me nothing more than something as, typed
in this message so watch errors.

\\\\
dim columnames() as string = {"column1", "column2", etc}
dim toselect as string
for each col as integer in WhatIGot
toselect = columnames(col) & ","
next
toselect = toselect.lenght - 1
dim selectstring as string = "select " & toselect & "from mytable"
da.selectcommand = selectstring
///

I hope this helps,

Cor
 
Back
Top