DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Fri, 27 Jul 2007 20:51:09 -0000,    posted on: microsoft.public.dotnet.framework.adonet        back       

Thread Index
  1    cptkirkh
          2    glennanthonyb


bind variables oracle visual basic   
I have a query that looks up the highest value for column a and then
returns column a and column b.  It uses a nested select in the from
clause.  I want to use bind variables for my parameters but have found
out i can't use bind variables in the from clause.  It keeps returning
no records when i can run this same query in toad and it returns
records.  My question is can anyone help me wiht how to do this?  Here
is my code:

        Dim con As New OracleConnection(cnCICString)
        Dim cmd As New OracleCommand
        Dim da As OracleDataAdapter = New OracleDataAdapter(cmd)
        con.Open()
        cmd.Connection = con
        cmd.CommandType = CommandType.Text
        cmd.CommandText = "select ec.ec_export_number,ec_date from
event_campaign ec, " & _
        " (select max(ec_export_number) as maxexport  from
event_campaign" & _
        " where EC_PURPOSE = :event_purpose AND EC_ITEM_SENT
= :item_sent" & _
        " and EC_SQL = :sql_totalcount ) maxresults where " & _
        "  ec.ec_export_number = maxresults.maxexport and EC_PURPOSE
= :event_purpose AND    EC_ITEM_SENT = :item_sent " & _
        "  and  EC_SQL = :sql_totalcount"

cmd.Parameters.Add(":sql_totalcount", OracleDbType.Varchar2).Value =
"select cli_rid from dual"
        cmd.Parameters.Add(":event_purpose",
OracleDbType.Varchar2).Value = "20070511TXAM"
        cmd.Parameters.Add(":item_sent", OracleDbType.Varchar2).Value
= "POSTCARD"
Date:Fri, 27 Jul 2007 20:51:09 -0000   Author:  

Re: bind variables oracle visual basic   
Colon's are only required in the SQL statement, remove them from the 
parameter name argument passed to the Add method.

"cptkirkh"  wrote in message 
news:1185569469.468787.10970@w3g2000hsg.googlegroups.com...

>I have a query that looks up the highest value for column a and then
> returns column a and column b.  It uses a nested select in the from
> clause.  I want to use bind variables for my parameters but have found
> out i can't use bind variables in the from clause.  It keeps returning
> no records when i can run this same query in toad and it returns
> records.  My question is can anyone help me wiht how to do this?  Here
> is my code:
>
>        Dim con As New OracleConnection(cnCICString)
>        Dim cmd As New OracleCommand
>        Dim da As OracleDataAdapter = New OracleDataAdapter(cmd)
>        con.Open()
>        cmd.Connection = con
>        cmd.CommandType = CommandType.Text
>        cmd.CommandText = "select ec.ec_export_number,ec_date from
> event_campaign ec, " & _
>        " (select max(ec_export_number) as maxexport  from
> event_campaign" & _
>        " where EC_PURPOSE = :event_purpose AND EC_ITEM_SENT
> = :item_sent" & _
>        " and EC_SQL = :sql_totalcount ) maxresults where " & _
>        "  ec.ec_export_number = maxresults.maxexport and EC_PURPOSE
> = :event_purpose AND    EC_ITEM_SENT = :item_sent " & _
>        "  and  EC_SQL = :sql_totalcount"
>
> cmd.Parameters.Add(":sql_totalcount", OracleDbType.Varchar2).Value =
> "select cli_rid from dual"
>        cmd.Parameters.Add(":event_purpose",
> OracleDbType.Varchar2).Value = "20070511TXAM"
>        cmd.Parameters.Add(":item_sent", OracleDbType.Varchar2).Value
> = "POSTCARD"
> 
Date:Tue, 31 Jul 2007 10:43:43 +0100   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us