Skip to main content

Posts

Showing posts from September, 2008

IBM.Data.DB2.iSeries Class

Error Message: Object reference not set to an instance of an object. or IBM.Data.DB2.iSeries.iDB2SQLErrorException: SQL0666 Estimated query processing time 56 exceeds limit 30. Private Sub btnUpdate1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate1.Click Dim cn As iDB2Connection = New iDB2Connection("User ID=me;Password=me;Data Source=TESTIP;Connection Timeout = 0") cn.Open() Dim strQuery As String = String.Empty strQuery = "Select * from Employee" Dim cmd As iDB2Command = New iDB2Command(strQuery, cn) cn.Close() End Sub ================================================================ SOLUTION: The iDB2Command command timeout must be set to 0 (zero) to override the default of 30. If your job is estimated to run longer than 30 seconds you will receive an exception. Private Sub btnUpdate1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate1.Click Dim cn As iDB2Connection = New

Pesky Multiple button clicks…

Error: I have to click the cancel(OK, Yes, No) button twice in my form. Components used: Messagebox.show (String,String,messageboxbuttons,Icon) returns dialog result. Example code: Sub Main MessageBox.Show("*Please Note: This is a really long process. Select OK continue or Cancel to exit application.", "SUBMIT CONFIRMATION", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) If (MessageBox.Show("*Please Note: This is a really long process. Select OK continue or Cancel to exit application.", "SUBMIT CONFIRMATION", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) = Windows.Forms.DialogResult.Cancel) Then Me.Close() Else Do something.... End If End Sub Problem: The OK and Cancel buttons must be selected twice before the next line is processed. Solution: Don’t be an idiot! You are calling this function twice! Remove the first MessageBox.Show command. TIMER & PROGRESS BAR TIPS: Don’t attempt to add a timer or progress bar within a long runni