CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 58

Thread: RowDataBound(:

  1. #16
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: RowDataBound(:

    When you call the function you need to specify the SupportstaffID as it is currently it is always 0 and you need to use the return value. If you are not going to use a return value then you should be using a sub rather than a function.

    Example
    Code:
    MyRetunredData=clsSupportStaffQuota_Obj.CalculateQuota(MySupportStaffID)
    You also still have another issue where you are setting NewTicket during each pass of the loop. NewTicket will only have the last value assigned which is also something I think you would not be wanting here.

  2. #17
    Join Date
    Mar 2009
    Location
    Singapore
    Posts
    53

    Re: RowDataBound(:

    hmmm ok..i've changed it to sub now..
    and i have another doubt..
    in the formula,for the variable "TotalTickets"
    how do i get the value??
    i have the sql statement,but i don't know how to parse in the value..
    pls help

  3. #18
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: RowDataBound(:

    I do not know enough about what you are trying to do to answer that question

  4. #19
    Join Date
    Mar 2009
    Location
    Singapore
    Posts
    53

    Re: RowDataBound(:

    Code:
    If QuotaAns > (SupportStaffID = 11) Or (SupportStaffID = 15) Then
                    newTicket = (SupportStaffID = 10)
    
                ElseIf QuotaAns > (SupportStaffID = 10) Or (SupportStaffID = 15) Then
                    newTicket = (SupportStaffID = 11)
                Else
                    newTicket = (SupportStaffID = 15)
                End If
    what i'm trying to do here is actually :
    if the quotaAns is greater then supportStaffID 11 and 15, the new ticket must be assigned to SUpportStaffID 10
    and the next line is:
    if the quotaAns is Greater then SupportSTaff ID 10 and 15, the new ticket must be assigned to SupportSTaffID 11
    or else assign the new ticket to SUpportStaffID15

    but i cant get this thing ryte..how?my formula is also not working

  5. #20
    Join Date
    Mar 2009
    Location
    Singapore
    Posts
    53

    Re: RowDataBound(:

    and btw..what is select case??

  6. #21
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: RowDataBound(:

    It is like and If ElseIF End IF block but easier to read

    Example

    Code:
    Select Case MYVar
        Case 1
            'Do Something
        Case 2
             ' Do Something Different
        Case 3,4,5
             'Do Something Different
        Case Else
             'Do Something Else
    End Select
    Is the same as

    Code:
    If MYVar=1 Then
        'Do Something
    ElseIF MyVar=2 then
         ' Do Something Different
    ElseIf MyVar=3 or MyVar=4 or MyVar=5 Then
          'Do Something Different
    Else
          'Do Something Else
    End IF

  7. #22
    Join Date
    Mar 2009
    Location
    Singapore
    Posts
    53

    Re: RowDataBound(:

    yep i'm also trying that out..so sorry to trouble u so much..
    but i seriously need your help..

    but the problem now is :
    i cant get my formula working..
    because the totalTicket variable in my formula couldn read..
    i want to know how to make the formula to get the value..
    is it from the sql statement??

  8. #23
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: RowDataBound(:

    Quote Originally Posted by BabyAngel View Post

    what i'm trying to do here is actually :
    if the quotaAns is greater then supportStaffID 11 and 15, the new ticket must be assigned to SUpportStaffID 10
    and the next line is:
    if the quotaAns is Greater then SupportSTaff ID 10 and 15, the new ticket must be assigned to SupportSTaffID 11
    or else assign the new ticket to SUpportStaffID15

    but i cant get this thing ryte..how?my formula is also not working
    So SupportStaffID is an array?

    If so then instead of (SupportStaffID=15) you may be wanting SupportStaffID(15)

  9. #24
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: RowDataBound(:

    Quote Originally Posted by BabyAngel View Post
    yep i'm also trying that out..so sorry to trouble u so much..
    but i seriously need your help..

    but the problem now is :
    i cant get my formula working..
    because the totalTicket variable in my formula couldn read..
    i want to know how to make the formula to get the value..
    is it from the sql statement??
    I can not answer that. I do not know how you get your tickets nor how many you have or where that data may come from. This may need to come from your database or from user input but you are in a better position to answer that question than I would be.

  10. #25
    Join Date
    Mar 2009
    Location
    Singapore
    Posts
    53

    Re: RowDataBound(:

    yes it should be coming from the database..
    i have this sql statement in my class to count how many tickets each support staffs has
    Code:
        Public Function DBSelect_TotalTickets(Optional ByVal SupportStaffID As Integer = 0) As DataTable
            Dim local_dbConn As New SqlConnection
            Dim local_sqlCommand As New SqlCommand
    
            local_dbConn = db_conn.DBConn
            local_sqlCommand.Connection = local_dbConn
    
            local_sqlCommand.CommandText = "SELECT COUNT(ID) FROM ITHelpDesk.dbo.Tickets where SupportStaffID = @xSupportStaffID"
            local_sqlCommand.CommandText = CommandType.Text
    
            Dim sql_adapter As New SqlDataAdapter(local_sqlCommand)
            Dim dt As New DataTable
            sql_adapter.Fill(dt)
            If dt.Rows.Count > 0 Then
                dt.PrimaryKey = New DataColumn() {dt.Columns("ID")}
            End If
    
            local_dbConn.Close()
            Return dt
    
        End Function
    but how do i call this in my formula??

  11. #26
    Join Date
    Mar 2009
    Location
    Singapore
    Posts
    53

    Re: RowDataBound(:

    nope supportStaffID must retrieve from database..not an array..i just tried putting the statement when the ID is equals to 15..but not wroking as well..

  12. #27
    Join Date
    Mar 2009
    Location
    Singapore
    Posts
    53

    Re: RowDataBound(:

    hey ya..
    i tried another method to actually try to get the values in my formula..
    so i changed my dim statements to this so that i can call the select statements and get the values..
    Code:
      Dim newTicket As Integer = (Convert.ToString(Me.DBSelect_NewTicketID))
            Dim TotalTickets As Integer = (Convert.ToString(Me.DBSelect_TotalTickets))
            Dim Quota As Double = (Convert.ToString(Me.DBSelectQuota))
            Dim QuotaAns As Double
    
            QuotaAns = (1 / (TotalTickets + 1)) * Quota
    and then i debugged my programe and i had this error message sayin
    "Line 1: Incorrect syntax near '1'."
    Code:
      Dim sql_adapter As New SqlDataAdapter(local_sqlCommand)
            Dim dt As New DataTable
            sql_adapter.Fill(dt)
            If dt.Rows.Count > 0 Then
                dt.PrimaryKey = New DataColumn() {dt.Columns("ID")}
            End If
    thrid line from the start shows this error..
    any idea what is it??

  13. #28
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: RowDataBound(:

    1 is NOT a Double, which is a problem. You can use a variable, or convert it. Look up TryCast()
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  14. #29
    Join Date
    Mar 2009
    Location
    Singapore
    Posts
    53

    Re: RowDataBound(:

    erm i kind of dont get what you saying..

  15. #30
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: RowDataBound(:

    Quote Originally Posted by BabyAngel View Post
    hey ya..
    i tried another method to actually try to get the values in my formula..
    so i changed my dim statements to this so that i can call the select statements and get the values..
    Code:
      Dim newTicket As Integer = (Convert.ToString(Me.DBSelect_NewTicketID))
            Dim TotalTickets As Integer = (Convert.ToString(Me.DBSelect_TotalTickets))
            Dim Quota As Double = (Convert.ToString(Me.DBSelectQuota))
            Dim QuotaAns As Double
     
            QuotaAns = (1 / (TotalTickets + 1)) * Quota
    and then i debugged my programe and i had this error message sayin
    "Line 1: Incorrect syntax near '1'."
    Code:
      Dim sql_adapter As New SqlDataAdapter(local_sqlCommand)
            Dim dt As New DataTable
            sql_adapter.Fill(dt)
            If dt.Rows.Count > 0 Then
                dt.PrimaryKey = New DataColumn() {dt.Columns("ID")}
            End If
    thrid line from the start shows this error..
    any idea what is it??
    3rd line in which piece of code?

    What is the local_SqlCommand being passed?

    note that it says '1' if it is a numeric field you should not be using the 's as they are for text fields and date fields not numbers.

    Also I have no idea why you are using doubles here. I would think that dealing with tickets you would always want a whole number e.g. Integer rather than a fp number.

    Why are you using convert.Tostring when you are assigning to a numeric variable?

Page 2 of 4 FirstFirst 1234 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured