如何获得2个字符前后的特定字符串的返回 [英] How Do I Get A Return A Certain String Before And After 2 Characters

查看:110
本文介绍了如何获得2个字符前后的特定字符串的返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以从文本框中编写任何查询,例如..

I can write any query from a text box for eg..

Select * from table

select product from food

Delete * from good

select product,quantity,id from food



我如何获得foodFROM后面的单词

我只需要用表名来表示

请帮助任何人.



How can i get the food or the word just after the word FROM

i need to extact just table name

please help anyone

推荐答案

请阅读我对问题的评论.

您所需要做的就是找到FROM单词,而不是提取表名称.
如何:使用字符串方法搜索字符串(C#编程指南) [如何:在字符串中搜索(Visual Basic) [如何:使用正则表达式搜索字符串(C#编程指南) [ developerfusion在线转换器 [
Please, read my comment to the question.

All you need to do is to find FROM word than to extract table name.
How to: Search Strings Using String Methods (C# Programming Guide)[^]
How to: Search Within a String (Visual Basic)[^]
How to: Search Strings Using Regular Expressions (C# Programming Guide)[^] - true, it''s c#, but you can convert it via for example developerfusion online converter[^]

But i need to warn you. In some cases, sql query could looks like:
SELECT <field list>
FROM (
    SELECT <field list>
    FROM TableName
    WHERE <condition>
) AS T
WHERE <condition>


您希望找到什么?

请阅读以下文章:
SQL解析器 [ Microsoft.SqlServer.Management.SqlParser.Parser命名空间 [ ^ ]
在那里,您会找到许多有用的信息.


What do you expect to find?

Please, read these articles:
SQL Parser[^]
Microsoft.SqlServer.Management.SqlParser.Parser Namespace[^]
There you''ll find many usefull information.


这篇关于如何获得2个字符前后的特定字符串的返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆