string str="tanlin"; string strUpdate = "update FileTable set cFilePath=Left(cFilePath,InStr(cFilePath,'"+str+"')) where cFilePath like '文件管理\\tanlin%'"; DataOperate.ExecuteNonQuery(strUpdate);
string strUpdate = "update FileTable set cFilePath=Left(cFilePath,InStr(cFilePath,'"+str+"')) where len(cFilePath)>=len('" + str + "') cFilePath like '文件管理\\tanlin%'"; 好些年不针对access写sql了
也不对啊,它报错了,说InStr(cFilePath,'"+str+"')中str的字符太多啊
string strUpdate = "update FileTable set cFilePath=Left(cFilePath,InStr(cFilePath,'"+str+"')) where len(cFilePath)>=len('" + str + "') and cFilePath like '文件管理\\tanlin%'";刚才本身写得就有错
sql执行没错,语句也没错。都没报错,就是没改,我执行string strUpdate = "update FileTable set cFilePath=Left(cFilePath,5) where cFilePath like '文件管理\\tanlin%'"; 能改 我快速监视了一下InStr(cFilePath,'"+str+"')的值,说是字符文本中的字符太多
string strUpdate = "update FileTable set cFilePath=Left(cFilePath,InStr(cFilePath,'"+str+"')) where cFilePath like '文件管理\\tanlin%'";
DataOperate.ExecuteNonQuery(strUpdate);
可选项。数值表达式,用于设置每次搜索的开始位置。如果省略,将从第一个字符的位置开始搜索。如果 start 包含 Null,则会出现错误。如果已指定 compare,则必须要有 start 参数。
string1
必选项。接受搜索的字符串表达式。
string2
必选项。要搜索的字符串表达式。
compare
可选项。指示在计算子字符串时使用的比较类型的数值。有关数值,请参阅“设置”部分。如果省略,将执行二进制比较。
设置第二个串不应长过第一个串...
我快速监视了一下InStr(cFilePath,'"+str+"')的值,说是字符文本中的字符太多