Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Call a Stored Proc behind a button

Hi Guys,

I am working on a new QlikView requirement where I am working to make QlikView Report/Dashboard more intuitive by making some transactional control on it.

I have a requirement where I want to call a stored procedure by a Button on QlikView.

So when I click the button, I want to run the following command  EXEC sp_xx_yy

Please advice

Regards

Naveen


13 Replies
Not applicable
Author

Clever Anjos - Thanks for this.

But, where am I calling the Stoerd Procedure here ?

I mean the "EXEC sp" command ?

I also need to pass a few variables with this Stored Procedure, But I'll handle the variables separately.

Clever_Anjos
Employee
Employee

It executes on line 08 .Execute

If you need to suply parameters use as this

sp = "YOUR STORED PROCEDURE"

Set cmd = CreateObject("ADODB.Command")

With cmd

  .ActiveConnection = "YOUR CONNECTION STRING"

  .CommandType = 4

  .Parameters.Append .CreateParameter("@param1", adVarWChar, adParamInput, 50, "a value")

  .Parameters.Append .CreateParameter("@param2", adVarWChar, adParamInput, 50, "another value")

  .CommandText = sp

  .Execute ' this will execute your proc

End With

Set cmd = Nothing

Clever_Anjos
Employee
Employee

Good remembering

chetanpatel
Contributor III
Contributor III

what i am doing wrong here 

SUB insert

Set cmd = CreateObject("ADODB.Command")
With cmd
.ActiveConnection = "Provider=sqloledb;Data Source=servername;Initial Catalog=DB"
.CommandType = 4
.CommandText = "INSERT INTO [DB].[Utility].[QlikviewLoadInfo] ([QlikAppNM],[RunDT]) VALUES ('Test', '2022-10-19')"
.Execute
End With
Set cmd = Nothing
End Sub