vbs 연결 sqlserver 데이터베이스 모호 조회 추출 데이터,msgbox 로 모두 표시

1082 단어 VBScript
Dim DB 
Dim isSQL
Dim i 
dim tag
dim Describe
dim Addr1
dim Addr2
dim Addr3
dim Addr4
dim str
dim str1
str=""

Set DB = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.RECORDSET") 
i = 0
'tag="P1103B"
tag=inputbox ("   Tag")

DB.Open "Driver=SQL Server;server=   ;Database=     ;uid=sa;pwd=sa   ;"

isSQL = "select * from IoTable where Tag like '%"&tag&"%'"

Set objRecordSet = DB.Execute(isSQL)

Do While Not objRecordSet.EOF
  
  Addr1 =objRecordSet("  ")+"  "
  Addr2 =Addr1+objRecordSet("  ")+"  "
  Addr3 =Addr2+objRecordSet("  ")+"  "
  if objRecordSet("  ") & "" = ""  then
	str1="null"
	Addr4 =Addr3+str1+ vbcrlf
	str = Addr4+str
  else
	Addr4 =Addr3+objRecordSet("  ")+"  "+ vbcrlf
	str = Addr4+str
  end if	

  
  i = i +1
  
 
 objRecordSet.MoveNext 
 
Loop

if i<=0 then
	msgbox "       "
else
	
	msgbox str
	
end if	



좋은 웹페이지 즐겨찾기