str1 = "db1('User_Name')"
Debug.Print db1("User_Name")
Debug.Print Replace(str1, "'", """")结束:
管理员
db1("User_Name")怎样才能把这两个print显示一样的结果
都为“管理员”
Debug.Print db1("User_Name")
Debug.Print Replace(str1, "'", """")结束:
管理员
db1("User_Name")怎样才能把这两个print显示一样的结果
都为“管理员”
你将'替换成",得到的结果当然是db1("User_Name")了
str1 = "db1(""User_Name"")"
Debug.Print db1("User_Name")
Debug.Print str1
Debug.Print db1("User_Name")
Debug.Print Replace(str1, "'", """)
你的语句是不正确的
db1("User_Name")是代码,运行后得到一个字符串值"管理员"。
而replace只是对str1中的字符进行替换,对于程序来说,这个的结果就是字符串db1("User_Name")。
如果一定要用字符串读取field的话,是不是应该用sql啊?
我的语法没有问题,只是这种方法执行出来的结果不是我想要的