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
turbot_yuAsked:
Who is Participating?
 
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
 
Ryan ChongCommented:
try:

cn.Execute cmdstr, dbSQLPassThrough

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

dbSQLPassThrough not defined.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
Ryan ChongCommented:
is cn an ADO Connection object? hmm... sorry, maybe:

cn.Execute cmdstr

?
0
 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.