We've expanded our news coverage and improved our search! Visit
oreilly.com for the latest or search for all things across O'Reilly!
Article:
 |
|
Transparent Database Access with ADO.NET
|
| Subject: |
|
Parameters |
| Date: |
|
2003-06-09 20:00:04 |
| From: |
|
anonymous2
|
Response to: Parameters
|
|
One way a manage this problem is using String.Format() function. For example:
private const string SQL_GET_RECORD = "SELECT * FROM UserTbl WHERE id = {0} AND name='{1}'";
You can format your string like this:
String.Format(SQL_GET_RECORD_BY_ID,123,'jesse');
This will produce the following string:
SELECT * FROM UserTbl WHERE id = 123 AND name='jesse'
Hope it helps,
Jesse
|