Jump to content

Search the Community

Showing results for tags 'array'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General Discussion
    • Get Started
    • WebMap
    • VBUC
    • Silverlight Bridge
    • SnowConvert
    • Blogs

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 2 results

  1. VB6 code: If svrqAuthorise Is Nothing Then lvstrSQL = "" ASQL lvstrSQL, "UPDATE tblEEntityDuplicates" ASQL lvstrSQL, "SET" ASQL lvstrSQL, "AuthorisedBy1 = " & FormatSQL(pvobjContext.UserID) & "," ASQL lvstrSQL, AuditSQL(pvobjContext, ecSQLbuilder.UpdateModifyFields) & "," ASQL lvstrSQL, "ProcessStatus = 1 ," ASQL lvstrSQL, "ProcessStatusMessage = 'Authorised 1'" ASQL lvstrSQL, "WHERE EntityRefToMoveFrom = ?" Set svrqAuthorise = New ADODB.Command svrqAuthorise.CommandText = lvstrSQL svrqAuthorise.ActiveConnection = pvobjContext.Connection End If svrqAuthorise.Parameters(0) = mvlngEntityRefToMoveFrom Generated code: if (svrqAuthorise_Authorise1 == null) { lvstrSQL = ""; UCommon.ASQL(ref lvstrSQL, "UPDATE tblEEntityDuplicates"); UCommon.ASQL(ref lvstrSQL, "SET"); //UPGRADE_WARNING: (1068) FormatSQL() of type Variant is being forced to string. More Information: https://www.mobilize.net/vbtonet/ewis/ewi1068 // EWI Solution Progress: EWI ID:1068 Status: TODO Fixed By: Asmita Date: 03/10/2019 UCommon.ASQL(ref lvstrSQL, "AuthorisedBy1 = " + Convert.ToString(UCommon.FormatSQL(pvobjContext.UserID)) + ","); UCommon.ASQL(ref lvstrSQL, UContext.AuditSQL(pvobjContext, UEnums.ecSQLbuilder.UpdateModifyFields) + ","); UCommon.ASQL(ref lvstrSQL, "ProcessStatus = 1 ,"); UCommon.ASQL(ref lvstrSQL, "ProcessStatusMessage = 'Authorised 1'"); UCommon.ASQL(ref lvstrSQL, "WHERE EntityRefToMoveFrom = ?"); svrqAuthorise_Authorise1 = UpgradeHelpers.DB.AdoFactoryManager.GetFactory().CreateCommand(); svrqAuthorise_Authorise1.CommandText = lvstrSQL; svrqAuthorise_Authorise1.Connection = pvobjContext.Connection; UpgradeHelpers.DB.DbConnectionHelper.ResetCommandTimeOut(svrqAuthorise_Authorise1); } svrqAuthorise_Authorise1.Parameters[0].Value = mvlngEntityRefToMoveFrom; The problem is parameters array is no initialized in converted code so it leads to a runtime exception. How can I solve it in a way I don't need to go over every database access method and manually initialize parameters? Best regards!
  2. I'm getting an index out IndexOutOfRange Exception, here is my code in vb6: Public Function GetDelimitedWord(ByVal pvstrInput As String, _ ByVal pvintItem As Integer, _ ByVal pvstrDelim As String) As String Const lcstrPROC_NAME As String = "GetDelimitedWord" Dim lvintCounter As Integer Dim lvintNewStartPos As Integer Dim lvintStartPos As Integer Dim lvintEndPos As Integer On Error GoTo ErrorHandler lvintCounter = 1 lvintStartPos = 1 For lvintCounter = 2 To pvintItem lvintNewStartPos = InStr(lvintStartPos, pvstrInput, pvstrDelim) + 1 If lvintNewStartPos < lvintStartPos Then lvintStartPos = Len(pvstrInput) + 1 Exit For Else lvintStartPos = lvintNewStartPos End If Next lvintCounter lvintEndPos = InStr(lvintStartPos, pvstrInput, pvstrDelim) - 1 If lvintEndPos <= 0 Then lvintEndPos = Len(pvstrInput) End If GetDelimitedWord = Mid$(pvstrInput, lvintStartPos, lvintEndPos - lvintStartPos + 1) ExitHandler: Exit Function ErrorHandler: NonContextErrorRaise mcstrMODULE_NAME, lcstrPROC_NAME, Err.Number, Err.Source, Err.Description Resume ExitHandler Resume End Function And here is the code generated by the tool: internal static string GetDelimitedWord(string pvstrInput, int pvintItem, string pvstrDelim) { const string lcstrPROC_NAME = "GetDelimitedWord"; string result2 = ""; int lvintCounter = 0; int lvintNewStartPos = 0; int lvintStartPos = 0; int lvintEndPos = 0; try { lvintCounter = 1; lvintStartPos = 1; int tempForEndVar = pvintItem; for (lvintCounter = 2; lvintCounter <= tempForEndVar; lvintCounter++) { lvintNewStartPos = Strings.InStr(lvintStartPos, pvstrInput, pvstrDelim, CompareMethod.Binary) + 1; if (lvintNewStartPos < lvintStartPos) { lvintStartPos = Strings.Len(pvstrInput) + 1; break; } else { lvintStartPos = lvintNewStartPos; } } lvintEndPos = Strings.InStr(lvintStartPos, pvstrInput, pvstrDelim, CompareMethod.Binary) - 1; if (lvintEndPos <= 0) { lvintEndPos = Strings.Len(pvstrInput); } result2 = pvstrInput.Substring(lvintStartPos - 1, Math.Min(lvintEndPos - lvintStartPos + 1, pvstrInput.Length - (lvintStartPos - 1))); } catch (Exception theException) { theException.HandleError(theException); } return result2; } I have similar code in over 100 places in my code, how can I solve it? Thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use