0

While running below script I am getting the following error:

Format of the initialization string does not conform to specification starting at index 0

Can you help me to fix this issue?

Code is as below

<BaseObjectTypeAttribute("PwOHelperPwO")> _
Public Function CCC_GetProductIdent( ByVal dbPwOHelperPwO As ISingleDbObject) As String
    Dim scriptErrorBase As String = "Script Error [CCC_GetProductIdentfromRequest]"
    Dim returnValue As iDatareader
    Dim results As New StringBuilder
    Dim connData As ConnectData = DbApp.Instance.Connect(VID_GetValueOfDialogdatabases("ConnectionString"))
    Dim cSQL As SqlExecutor = Connection.CreateSqlExecutor(connData.PublicKey)
    Dim pwoUID As String = dbPwoHelperPwo.GetValue("UID_PersonWantsOrg")
    
    Dim myQuery As String = String.Format("select " &
                            "apg.Ident_AccProductGroup " &
                            "from PersonWantsOrg pwo" &
                            " inner join QERAssign qas" &
                            "  On pwo.ObjectKeyOrdered = qas.XObjectKey" &
                            " inner join AccProduct apd" &
                            "  On qas.UID_AccProduct = apd.UID_AccProduct" &
                            " inner join AccProductGroup apg" &
                            "  On apd.UID_AccProductGroup = apg.UID_AccProductGroup " &
                            "where pwo.UID_PersonWantsOrg = '{0}'",pwoUID)
    Try
        returnValue = cSQL.SqlExecute(String.Format(myQuery))
            
        While returnValue.Read()
              results.Append(returnValue("Ident_AccProductGroup").ToString)            
        End While
    Catch ex As Exception
        Throw New Exception(String.Format("{0} {1} {2}", scriptErrorBase, myQuery, ex))
    End Try
    
    Return results.ToString
    
End Function
colinD
  • 1,641
  • 1
  • 20
  • 22
  • 1
    I would say it's because of `SqlExecute(String.Format(myQuery))`. Since you already called `String.Format()` to get `myQuery`, you can remove the second call to `String.Format()`. So just `returnValue = cSQL.SqlExecute(myQuery)` – colinD Oct 19 '20 at 09:08
  • I did the compile again after removing string.fromat but no luck.Can you have a look at it again? – Baji Sharian Oct 19 '20 at 10:29
  • also to be noted my DB is encrypted so any issue with connection string? – Baji Sharian Oct 19 '20 at 11:08
  • It might be an error in the connection string, so a duplicate of [this](https://stackoverflow.com/questions/8243008/format-of-the-initialization-string-does-not-conform-to-specification-starting-a) – colinD Oct 19 '20 at 11:27
  • I went through the link but it didn't help me.how to decrypt my connection? – Baji Sharian Oct 19 '20 at 12:53

0 Answers0