读书人

者不者不,教一的

发布时间: 2012-01-06 22:55:18 作者: rapoo

者不,者不,教各位高手一的文件中取字串的。
[oledb]
; Everything after this line is an OLE DB initstring
Provider=SQLOLEDB.1;Password=topcomputer;Persist Security Info=True;User ID=sa;Initial Catalog=FLSystem;Data Source=nt04
如何把上面的接的字符串取出,以上是一*.udl文件。

Provider=SQLOLEDB.1;Password=topcomputer;Persist Security Info=True;User ID=sa;Initial Catalog=FLSystem;Data Source=nt04


[解决办法]
正则表达式应该可以实现吧
[解决办法]
string oldstr= "[oledb]; Everything after this line is an OLE DB initstring Provider=SQLOLEDB.1;Password=topcomputer;Persist Security Info=True;User ID=sa;Initial Catalog=FLSystem;Data Source=nt04 ";

string newstr = oldstr.Substring(oldstr.IndexOf( "Provider "), oldstr.Length - oldstr.IndexOf( "Provider "));

//验证通过
[解决办法]
Provider=SQLOLEDB.1;Password=topcomputer;Persist Security Info=True;User ID=sa;Initial Catalog=FLSystem;Data Source=nt04
是永远放在文件的最末端吗?

读书人网 >C#

热点推荐