Answered by:
error in querry string by Replace

Question
-
User-1290459327 posted
Dear reader,
Can someone tells my why my string gives an error by "Replace" he say the name replace does not excesit in current context
In my vb website with sql it's workeing, in my c-charp website with Mysql it does not working
Saturday, July 2, 2011 4:46 PM
Answers
-
User-1235297830 posted
Hi,
I am guessing as the syntax for replace is xxxx.replace('', ''). So The syntax should be project.replace('','').
Thanks
Manju
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Saturday, July 2, 2011 6:21 PM -
User-1290459327 posted
Yep projects is the table and project is the collum in that table,
So when i set choose value in the DropdownList, the GridView must show That value.
example:
When I take the value myproject in the dropdownlist ddl1 , only myproject must be showed in the gridview GridView- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, July 4, 2011 12:34 PM
All replies
-
User-1235297830 posted
Hi,
If it is C# try '+' instead of '&' sign
Thanks
Manju
Saturday, July 2, 2011 5:03 PM -
User-1290459327 posted
Hoi manjunath_praj,
Thanks for the reply but + or & makes no differnt. the replace in my code is still not wel
Saturday, July 2, 2011 6:02 PM -
User-1235297830 posted
Hi,
I am guessing as the syntax for replace is xxxx.replace('', ''). So The syntax should be project.replace('','').
Thanks
Manju
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Saturday, July 2, 2011 6:21 PM -
User-1290459327 posted
Thanks manjunath_praj,
Youre answer helps,
Sunday, July 3, 2011 6:03 AM -
User-1290459327 posted
Lol it works great,
But (there is always a but) i have two projects now now i was hoping that the replace was filtering the grid view with only the one i seleced in de dropdownlist but both projects become vissible in gridview. My string looks like,
string projeqr = ("SELECT * from projects WHERE CreatedBy=" + (UserId) + " " + "AND ProjName LIKE '%" + project.Replace(project, "'"));
Sunday, July 3, 2011 7:38 AM -
User-1235297830 posted
Hi,
Is it because of 2 declarations "SELECT * from projects... " and project.Replace(project, "'"));
Is projects and project differ from each other?
Thanks
ManjuMonday, July 4, 2011 12:20 PM -
User-1290459327 posted
Yep projects is the table and project is the collum in that table,
So when i set choose value in the DropdownList, the GridView must show That value.
example:
When I take the value myproject in the dropdownlist ddl1 , only myproject must be showed in the gridview GridView- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, July 4, 2011 12:34 PM