C# dynamic database query

Status
Not open for further replies.

glenthas

Ars Tribunus Angusticlavius
6,979
Subscriptor++
I want to do something and I'm hoping you guys know an easy way to do it.

I want to let a user build an string from within a program that contains fieldnames from a database, e.g.

Code:
messageString = "Hello myDataReader["firstName"]";

Then to loop through it like this:
Code:
for (int i=0; i<NameArray.length; i++)
{
     messageBody = messageString;
}

What I need to find is an easy way to recognize the "myDataReader bit as code and not part of the string.

Any ideas or clarifications needed?

Thanks,

Brian
 
Status
Not open for further replies.