您的位置:首页 > 数据库 > Oracle

VB链接远程Oracle代码

2016-06-13 09:00 323 查看
Dim Conn As ADODB.Connection

       Dim  rs  As ADODB.Recordset  

       Dim strds As String
       Dim strConn As String    

strds = Chr(34) & "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.0.0.1)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=topprod)))" & Chr(34)  

      strConn = "Provider=MSDAORA.1;Password=test;User ID=test;Data Source=" & strds & ";Persist Security Info=True"  

       Conn = New ADODB.Connection  

       rs = New ADODB.Recordset  

      Conn.ConnectionString  = strConn

      Conn.Open 

       Dim sql As String

     sql ="select tlf06,tlf10*tlf60 as tlf10,tlf036,tlf037,tlf13 FROM tlf_file WHERE tlf01='" & p_ima01 &"' " & " AND tlf907 = 1" & "   AND tlf10 <> 0" & "   AND tlf902 NOT IN (SELECT jce02 FROM jce_file)" & "   AND tlf021 NOT IN (select cmw01 FROM cmw_file)"
& "   AND tlf902 = '" &  p_img02 &"' " & "   AND tlf903 = '" & p_img03  &"' "  & "   ORDER BY tlf06 DESC"

   rs = Conn.Execute(sql)  '建立记录集 

  Do While Not rs.EOF

      rs.MoveNext

  Loop

    Conn.Close
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  oracle vb