demausdauth's Profile User Rating: -----

Reputation: 176 Stalwart
Group:
Expert
Active Posts:
638 (0.39 per day)
Joined:
03-February 10
Profile Views:
12,740
Last Active:
User is offline Yesterday, 06:02 AM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Saturn
Dream Kudos:
50
Icon   demausdauth Getting frustrated with paydays -- nothing left :(

Posts I've Made

  1. In Topic: VB.net 2008 do while loop processing very slow

    Posted 29 Jul 2014

    I would guess that it is related to opening and closing the sql connection on each iteration of the Do/While. Perhaps you can move that outside of the loop:

    TextBox8.Text = "0"
            Dim val1 As Integer = 0
            Dim val2 As Integer = 0
            val1 = CInt(TextBox3.Text)
            val2 = CInt(TextBox7.Text)
            TextBox8.Text = val1 * val2
            DateTimePicker2.Value = DateTimePicker1.Value.AddDays(Integer.Parse(TextBox8.Text))
    
            Dim pplamt As Integer = 0
            Dim intamt As Integer = 0
            pplamt = CInt(TextBox2.Text.ToString)
            TextBox14.Text = "0"
            Dim index As Integer = 0
            Dim tdate As DateTime = DateTimePicker1.Value.Date
            Dim tot1 As Integer = 0
            Dim tot2 As Integer = 0
            tot1 = CInt(TextBox12.Text.ToString)
            Dim totint As Integer = 0
    
            'the using will automatically dispose of the sql connection for you when it is done
            Using conn As New SqlConnection(str_con)
    
                Do While index <= CInt(TextBox8.Text.ToString)
                    index += 1
                    tot2 += 1
                    If index > CInt(TextBox8.Text.ToString) Then
                        Exit Do
                    End If
    
                    DateTimePicker3.Value = DateTimePicker3.Value.AddDays(Integer.Parse(TextBox14.Text))
                    DateTimePicker2.Value = DateTimePicker3.Value
                    TextBox14.Text = "1"
                    TextBox10.Text = index
                    TextBox11.Text = DateTimePicker3.Value.Date
                    intamt = pplamt * (CInt(Label12.Text.ToString) / 100 / 365)
                    totint += intamt
    
                    Dim tv1 As Decimal = 0
                    tv1 = CInt(TextBox10.Text).ToString
    
                    If Not conn.State = ConnectionState.Open Then
                        conn.Open()
                    End If
    
                    'using will automatcally dispose of the command object for you but the connection object should still be available for the next itteration
                    Using comm As New SqlCommand("INSERT INTO fdmatcalc (fd_number,sl_no,date_start,ppl_amt,int_amt) values(@paramTextBox1, @paramTv1, @paramDateTime, @paramPplamt, @paramIntamt)", conn)
    
                        comm.CommandType = CommandType.Text
    
                        'Add the parameters
                        Dim sqlParameter As SqlParameter
    
                        'add textbox value
                        sqlParameter = New SqlParameter("@paramTextBox1", TextBox1.Text)
                        'add it to the command object
                        comm.Parameters.Add(sqlParameter)
    
                        'add the tv1 value  -- need to create a new parameter object
                        sqlParameter = New SqlParameter("@paramTv1", tv1)
                        'add to the command object
                        comm.Parameters.Add(sqlParameter)
    
                        'add the datetime value  -- need to create a new parameter object
                        sqlParameter = New SqlParameter("@paramDateTime", DateTimePicker3.Value.Date)
                        'add to the command object
                        comm.Parameters.Add(sqlParameter)
    
                        'add the pplamt value  -- need to create a new parameter object
                        sqlParameter = New SqlParameter("@paramPplamt", pplamt)
                        'add to the command object
                        comm.Parameters.Add(sqlParameter)
    
                        'add the intamt value  -- need to create a new parameter object
                        sqlParameter = New SqlParameter("@paramIntamt", intamt)
                        'add to the command object
                        comm.Parameters.Add(sqlParameter)
    
    
                        'all parameters added - execute the query
                        comm.ExecuteNonQuery()
    
                    End Using
    
    
    
                    If Label13.Text = "Daily" Then
                        pplamt = pplamt + intamt
                    End If
                    If Label13.Text <> "Daily" Then
                        If tot1 = tot2 Then
                            pplamt = pplamt + totint
                            tot2 = 0
                        End If
                    End If
                Loop
            End Using
    
    
    


    Also maybe there is a better way to do what you are trying to do - you should maybe re-examine your logic flow.
  2. In Topic: change numbers into order

    Posted 28 Jul 2014

    You could also use and an enum
    Public Enum Order
         None = 0
         First = 1
         Second = 2
         Third = 3
    End Enum
    
    
  3. In Topic: help with searching a DB via Datagridview

    Posted 25 Jul 2014

    What you are looking for is called a Master and Detail - one form displays all of your data and another displays all the data related a selected datarow from the master form.

    Here is a walkthrough you can start with - Master - Detail
  4. In Topic: Class function passing custom type structure variable array

    Posted 22 Jul 2014

    When you say that it doesn't work - what do you mean? Are you getting an error?
  5. In Topic: What is contained in a published ASP.net project?

    Posted 19 Jul 2014

    When you publish a asp.net application you will get (general overview) a bin folder with a <ProjectName>.dll - this is all the codebehind files compiled together. You will also get all the aspx files in their respective folder structure. With this type of approach you are generally moving all these files as they are to a web server, making a virtual application in IIS to allow people to browse to it. The publishing feature of Visual Studio has many different options - honestly I have only used the File System one.

    Here is a pretty good link to look over - here.

My Information

Member Title:
D.I.C Addict
Age:
Age Unknown
Birthday:
February 2
Gender:
Location:
Minnesota
Interests:
my family, reading, programming,
Full Name:
Aaron
Years Programming:
6
Programming Languages:
VB.NET, C#.NET, ASP.NET, SharePoint 2007 development

Contact Information

E-mail:
Private

Comments

Page 1 of 1
  1. Photo

    .nethelp Icon

    07 Apr 2012 - 14:31
    why did u put -1 on my reputation coz u know better? werent u like me before ? thanks anyways this truely shows ur good spirit and what a good mentor u are .
    bye
  2. Photo

    .nethelp Icon

    07 Apr 2012 - 14:31
    why did u put -1 on my reputation coz u know better? werent u like me before ? thanks anyways this truely shows ur good spirit and what a good mentor u are .
    bye
  3. Photo

    Guest 

    29 Jun 2010 - 13:54
    http://www.dreamincode.net/forums/topic/179550-updatepanels-placeholders-and-usercontrols/
  4. Photo

    joker_1 Icon

    13 Jun 2010 - 21:37
    Hi quick question.. What is the "e" argument??
    thanks heaps
  5. Photo

    demausdauth Icon

    11 Jun 2010 - 06:05
    lol -- not trying to break any records
  6. Photo

    CharlieMay Icon

    10 Jun 2010 - 18:31
    Just wanted to say, you keep answering questions like you do and your rep is going to sky-rocket.
Page 1 of 1