hey , I'm at unhandled error. if you can give me help I apreciate it :)
when I run software it say "connection already open". I find all, but I can't find.
If Len(Trim(txtloanids.Text)) < 4 Then
MessageBox.Show("Please Check Custormer ID", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
txtloanids.Focus()
Exit Sub
End If
query = "SELECT * FROM mcs.loan WHERE loan_id ='" & txtloanids.Text & "'"
Dim cmd As MySqlCommand = New MySqlCommand(query, con)
Dim dr As MySqlDataReader
Try
con.Open()
dr = cmd.ExecuteReader()
If (dr.HasRows) Then
While (dr.Read())
Me.txtcustormeridls.Text = Convert.ToString(dr("custormer_id"))
Me.txtcustormernamels.Text = Convert.ToString(dr("custormer_name"))
Me.txtcreditamounts.Text = Convert.ToDecimal(dr("credit_amount"))
Me.txtinterestrates.Text = Convert.ToDecimal(dr("interest_rate"))
Me.txtperiods.Text = Convert.ToString(dr("period"))
Me.txtinterestforcredits.Text = Convert.ToDecimal(dr("interest_for_credit"))
Me.txttotalamounts.Text = Convert.ToString(dr("total_amount"))
Me.txtdailyinstallments.Text = Convert.ToString(dr("daily_installment"))
Me.txtloandates.Text = Convert.ToDateTime(dr("loan_date"))
Me.txttotalamountls.Text = Convert.ToString(dr("total_amount"))
Me.Label105.Text = Convert.ToString(dr("loan_status"))
End While
query = "SELECT sum(Amount) as sumam FROM mcs.income WHERE Loan_ID ='" & txtloanids.Text & "'"
Dim cmd1 = New MySqlCommand(query, con)
Dim dr1 As MySqlDataReader
'Try
con.Open()
dr1 = cmd1.ExecuteReader()
While dr1.Read()
Me.txtreceivedls.Text = Convert.ToDecimal(dr1("sumam"))
End While
dr1.Close()
con.Close()
'Catch ex As Exception
' MsgBox(ex.Message)
MsgBox("This Laon Still Not Yet Received Any Settlment")
Try
If (con.State = ConnectionState.Open) Then
con.Close()
End If
Catch ex2 As Exception
MsgBox(ex2.Message)
End Try
'End Try
Else
MessageBox.Show("Search Loan With Another Loan ID", "This Loan Does Not Exist")
End If
con.Close()
Catch ex As Exception
MsgBox(ex.Message)
Try
If (con.State = ConnectionState.Open) Then
con.Close()
End If
Catch ex1 As Exception
MsgBox(ex1.Message)
End Try
End Try
txtarrearsls.Text = Val(txttotalamountls.Text) - Val(txtreceivedls.Text)