troubleshooting Question

creating a SQL statement at runtime

Avatar of mohantyd
mohantydFlag for India asked on
3 Comments1 Solution402 ViewsLast Modified:
Original statement
"update {0} set emp_name = {1} where emp_id = '{2}', tableName, empname,etc etc

using string.format
string sql = "string.Format("update {0} set emp_name = {1} where emp_id = '{2}', tableName, empname etc etc )

i will have a statement like original statement. Whole statement including tablename,setcolvalue... etc.
Like this there will be many sql statements stored as varchar in database.
this statements will run in a loop. so in run time how to replace the values ?
for examplw i want to get a statement like
"update table_Name set emp_name='" + Ds.Tables[0].Column[1] +"' where emp_id= '" + Ds.Tables[0].Column[2]+"'

saying the purpose i want to get different types of update statements from database and without changing code i want to update data's in tables. so in runtime i want to format the update statement. if you have any other suggestion on how to store the update statement please let me know.
Dennis Aries

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros