<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:snippet="http://codexchange.org/schemas/snippet/1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
  <channel>
    <title>CodeXchange: User Contributed Snippets</title>
    <link>http://www.codexchange.org</link>
    <description>Summary of the snippets published by a codexchange user</description>
    <language>en-us</language>
    <copyright>Copyright © CodeXchange, 2004-2006</copyright>
    <generator>CodeXchange RSS Feed Generator v1.0</generator>
    <webMaster>webmaster@codexchange.org</webMaster>
    <lastBuildDate>Thu, 15 Oct 2026 09:48:41 GMT</lastBuildDate>
    <ttl>20</ttl>
    <dc:language>en-us</dc:language>
    <dc:rights>Copyright © CodeXchange, 2004-2006</dc:rights>
    <dc:date>10/15/2026 9:48:41 AM</dc:date>
    <dc:publisher />
    <dc:creator>CodeXchange RSS Feed Generator v1.0</dc:creator>
    <item>
      <guid>/PreviewSnippet.aspx?SnippetID=f93231b1-c681-474b-9d41-9f9cff559d91</guid>
      <title>grab record from db and subtracts it from variable</title>
      <link>/PreviewSnippet.aspx?SnippetID=f93231b1-c681-474b-9d41-9f9cff559d91</link>
      <description>grab record from db and subtracts it from variable [VB.NET]</description>
      <author>Marcus Reed</author>
      <pubDate>Thu, 16 Sep 2010 13:28:58 GMT</pubDate>
      <comments>/PreviewSnippet.aspx?SnippetID=f93231b1-c681-474b-9d41-9f9cff559d91#comments</comments>
      <category>de2012da-757e-4af6-8537-6799adb7bce1</category>
      <dc:title>grab record from db and subtracts it from variable</dc:title>
      <dc:date>9/16/2010 1:28:58 PM</dc:date>
      <dc:creator>Marcus Reed</dc:creator>
      <content:encoded><![CDATA[<pre>        Try
            ' Takes a string from the textbox to find the records source in the database
            Dim aid As String = ArrestIDToolStripTextBox.Text
            Dim cmd As OleDbCommand = New OleDbCommand("SELECT SUM(AmountPaid) FROM tblPayment WHERE ArrestID ='" & aid & "'", con) ' SQL to pull the data from the database
            con.Open() ' open the connection to the database
            Dim amtpaid As Int32 = cmd.ExecuteScalar
            TextBox2.Text = amtpaid
            con.Close()
            Dim x1, x2 As Integer
            x1 = TextBox3.Text  ' Total Fine amount.
            x2 = TextBox2.Text  ' Total amount Paid so far.
            TextBox4.Text = Val(x1) - Val(x2) ' Subtracts the total fine amount from the amount paid to give us the total amount due.
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try</pre>]]></content:encoded>
      <snippet:downloads>0</snippet:downloads>
      <snippet:rating>0</snippet:rating>
      <snippet:language>VB.NET</snippet:language>
    </item>
  </channel>
</rss>