如何使用记录集在vb.net中使用seek命令 [英] how to use seek command in vb.net using recordset

查看:92
本文介绍了如何使用记录集在vb.net中使用seek命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在vb中的代码就像我在vb.net中的代码一样

 rsSUP.Seek " ,maccount_number
               如果 rsSUP.NoMatch = 错误 然后
                   tmpArry = Split(rsSUP.Fields(" )," ,,vbTextCompare)
                   trn_header = rsSUP.Fields(" )+ "  |" + mPERIOD 在这里检查 


因此,请帮助我如何使用mysql

在vb.net中的记录集找到它.您可以尝试以下通用VB .NET方法来获取文本和特定单词在带有查找操作的文件文本中.

 导入 System.IO
导入 System.Text.RegularExpressions

公共  FileReader
    公共 功能 GetText( ByVal  PathToFile 作为 字符串)
         Dim  fs  as   New  FileStream(PathToFile, FileMode.Open)
         Dim  sr  as  新建 StreamReader(fs)
         Dim  FileText  as  字符串
        
        FileText = sr.ReadToEnd
        
        返回 FileText
    结束 功能

    公共 功能 FindWordPosition( ByVal  FileText  as  字符串 ByVal 模式 As  匹配 as 匹配
         Dim  myRegex  as   Regex(样式)
        匹配= myRegex.Match(FileText)
        返回 match.Index
    结束 功能

结束  


My code in vb like that i need the code in vb.net

rsSUP.Seek "=", maccount_number
               If rsSUP.NoMatch = False Then
                   tmpArry = Split(rsSUP.Fields("sup_data"), "|", , vbTextCompare)
                   trn_header = rsSUP.Fields("sup_data") + "|" + mPERIOD 'check here


So pls help how can i find it using recordset in vb.net using mysql

解决方案

You can try the below generic VB .NET methods for getting text and a particular word in file text with seek operation.

Imports System.IO
Imports System.Text.RegularExpressions

Public Class FileReader
    Public Function GetText(ByVal PathToFile as String)
        Dim fs as New FileStream(PathToFile, FileMode.Open)
        Dim sr as New StreamReader(fs)  
        Dim FileText as string
        
        FileText = sr.ReadToEnd
        
        Return FileText
    End Function

    Public Function FindWordPosition(ByVal FileText as String, ByVal Pattern As String)
        Dim match as Match
        Dim myRegex as New Regex(Pattern)
        match = myRegex.Match(FileText)
        Return match.Index 
    End Function

End Class


这篇关于如何使用记录集在vb.net中使用seek命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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