MBA智库

查询sql 并且读取

  






//显示地址 //VBSBegin // Set obj = GetObject("winmgmts:\\.\root\cimv2") // Set IPConfigSet = obj.ExecQuery ("Select IPAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE") // For Each IPConfig in IPConfigSet // If Not IsNull(IPConfig.IPAddress) Then // For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress) // add = IPConfig.IPAddress(i) // MessageBox add // Next // End If // Next //VBSEnd //显示气泡提示信息 Sub neirong If Plugin.SQLServer.Connect("127.0.0.1,1433", "sa", "Aa3321965", "moge") Then //Call Plugin.Msg.Tips("连接成功啦") //连接SQLServer数据库 End If // //SELECT TOP 1000 [R_gonghao] // ,[R_bianma] // ,[R_xingming] // ,[R_sex] // ,[R_dianhua] // ,[R_bumen] // ,[R_kahao] // FROM [moge].[dbo].[renyuan] //查询SQLServer数据库 Reta = Plugin.SQLServer.SelectData("renyuan", "R_gonghao","R_gonghao<600") //Call Plugin.File.WriteFileEx("C:\第一个.txt",Reta) //MessageBox Retab dim MyArray MyArray = Split(Reta, "|") // UBound(MyArray)查出来数据有几个 //直接读取 //Call Plugin.Msg.Tips( Cstr(MyArray(2))) //一行一行读取------------------------------------------------- If UBound(MyArray)>=0 Then i=0 For UBound(MyArray) //下面这句是得到文本内容 SayString Cstr(MyArray(i)) Delay 10 //替换# MyArray(i) = replace(MyArray(i), "#", "") Delay 10 //Msgbox "成功输入第 " & i + 1 & " 行文本内容为:" & Cstr(MyArray(i)) //Call Plugin.File.WriteFileEx("C:\第一个.txt", Cstr(MyArray(i))) Call Lib.模拟表格.表格_置内容("1",1,i+1,MyArray(i)) Delay 10 i=i+1 Next End If End sub Event Form1.Button1.Click call Lib.模拟表格.表格_创建(Form1.Hwnd,"1",0,0,100,25,10,20) End Event Event Form1.Button2.Click Call Lib.模拟表格.表格_删除("1") End Event Event Form1.Button3.Click Call neirong End Event

  

posted @ 2016-05-26 15:59  冷色008  阅读(432)  评论(0编辑  收藏  举报