February 12, 2005 at 1:38 pm
Hi,
In Visual basic you can great a sub Like this, transfering object name as a parameter into sub, so code can be re used with all types of tables.
Sub SelectAnyTable(tbl as string, CWhere as string)
Dim Str as string
Str = "SELECT * FROM " & tbl & CWhere & ";"
....Run select statement to connected recordset
end Sub
QUESTION : How do you make TSQL re usable with different objects of the same type, ie Tables ??
Any examples or articles to help a learner
February 12, 2005 at 2:09 pm
Look up dynamic SQL on this site. Please be sure to find a posting with the article title similar to "The curse and blessing of Dynamic SQL". It is VERY important you understand the potential dangers involved in using Dynamic SQL.
I wasn't born stupid - I had to study.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy