[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

how to call a procedure in DB

Is there special setting to call a procedure,

I tried following, but not work.

cmdstr = "BEGIN poc_pmlevent(3001,0,'2006-01'," + CStr(LenBLOB) + ",'" + strArr(i) + "',121,0); END;"
cmd.CommandText = cmdstr
cmd.Execute
cn.CommitTrans

The sql is no problem when run in command line
0
turbot_yu
Asked:
turbot_yu
  • 6
  • 5
1 Solution
 
Ryan ChongCommented:
try:

cn.Execute cmdstr, dbSQLPassThrough

hope this helps.
0
 
turbot_yuAuthor Commented:
it said complie error

dbSQLPassThrough not defined.
0
 
Ryan ChongCommented:
is cn an ADO Connection object? hmm... sorry, maybe:

cn.Execute cmdstr

?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
turbot_yuAuthor Commented:
I first use this one, no error but cannot write into DB
0
 
turbot_yuAuthor Commented:
   Dim cn As New ADODB.Connection
    Dim cmd As New ADODB.Command
    Dim cmdstr As String
0
 
turbot_yuAuthor Commented:
   cn.ConnectionString = "Provider=MSDAORA.1;" + DB2String + "Data Source=" + datasourcename + ";Persist Security Info=True;"
    cn.Mode = adModeReadWrite
    cn.Open
    cmd.ActiveConnection = cn
0
 
Ryan ChongCommented:
not too sure if this is the connection string problem, i used this and works with my Oracel8i database when calling a Procedure:

cmdstr = "BEGIN poc_pmlevent(3001,0,'2006-01'," & CStr(LenBLOB) & ",'" & strArr(i) & "',121,0); END; "
ConnString="Provider=OraOLEDB.Oracle;Data Source=<<SERVER>>;User Id=<<USERID>>;Password=<<PWD>>"
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
    conn.ConnectionString = ConnString
    conn.Open
    conn.CursorLocation = adUseClient
   
conn.Execute cmdstr
...
0
 
turbot_yuAuthor Commented:
the connect string no problem, tried, but still not work,
no error, but canot write into
0
 
Ryan ChongCommented:
make user your Procedure is working? In the sense that it allow duplicate values to save into database?
0
 
turbot_yuAuthor Commented:
in cmd line, it works, no problem
0
 
Ryan ChongCommented:
so, what's the exact problem here, can you tell me how you solve it?
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now