vb.net 調用oracle的存儲過程

             ' getoracleconnection()是自己定義的一個內涵connectstring的連接
              Dim  conn  as  oracleconnection = getoracleconnection()
             
             
Dim  cmd  As   New  OracleCommand()
             cmd 
=  conn.CreateCommand
             
' Type默認為text,這里設為StoredProcedure 
             cmd.CommandType  =  CommandType.StoredProcedure

               
' StoredProcedure要用到的參數  
               Dim  para1  As   New  OracleParameter( " lstype_in " , OracleDbType.Int32, ParameterDirection.Input)
                    para1.Value 
=  item.lstype
              
Dim  para2  As   New  OracleParameter( " lsid_in " , OracleDbType.Int32, ParameterDirection.Input)
                    para2.Value 
=  item.lsid
              
Dim  para3  As   New  OracleParameter( " workid_in " , OracleDbType.Int32, ParameterDirection.Input)
                    para3.Value 
=  workid
               
' 選擇要使用的Procedure名字 
               cmd.CommandText  =   " LSW_EXTRACT_FROM_LS "
              
' 加入參數
               cmd.Parameters.Add(para1)
               cmd.Parameters.Add(para2)
               cmd.Parameters.Add(para3)
               
' 如果無參數返回,用ExecuteNonQuery,如果有,單值使用
                ' ExecuteScalar,多值使用 ExecuteReader  
               cmd.ExecuteNonQuery()
               
' 參數清除
               cmd.Parameters.Clear()
               
' cmd销毁
                cmd.dispose()
               

你可能感兴趣的:(oracle)