?multiple use of parameter in ADO tempory stored procedure?
Posted in 1999
Topics: Stored Procedures & SPL
How can I specifiy that a parameter should be used in a multiple no of locations within a tempory stored procedure ? Example of code I'm trying to avoid below. (Before someone tells me how better to rewrite to SQL to avoid the problem note I am using Informix SQL which appears to have a fairly basic functionality set) Cheers If Len(m_QryCust.CommandText) = 0 Then CreateQrySelCust End If m_QryCust("Fax1") = RTrim(strFax) & "%" m_QryCust("Fax2") = RTrim(strFax) & "%" m_QryCust("Fax3") = RTrim(strFax) & "%" Set rsIO = m_QryCust.Execute Debug.Print rsIO.ActiveCommand.CommandText Debug.Print rsIO.RecordCount Private Function CreateQrySelCust() m_QryCust.ActiveConnection = G_cn m_QryCust.CommandText = _ " SELECT title, initials, customer_name, Fax " & _ " FROM Customer " & _ " WHERE ((?='%' AND Fax IS NULL) OR (?<>'%' AND Fax LIKE ?)) " & _ " ORDER BY customer_name" m_QryCust.CommandType = adCmdText m_QryCust.CommandTimeout = 15 m_QryCust.Parameters.Append m_QryCust.CreateParameter("Fax1", adChar, adParamInput, 20) m_QryCust.Parameters.Append m_QryCust.CreateParameter("Fax2", adChar, adParamInput, 20) m_QryCust.Parameters.Append m_QryCust.CreateParameter("Fax3", adChar, adParamInput, 20) End Function