|
-
April 6th, 2009, 09:07 PM
#16
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.
-
April 6th, 2009, 09:19 PM
#17
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
-
April 6th, 2009, 09:25 PM
#18
Re: RowDataBound(:
I do not know enough about what you are trying to do to answer that question
-
April 6th, 2009, 09:25 PM
#19
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
-
April 6th, 2009, 09:26 PM
#20
Re: RowDataBound(:
and btw..what is select case??
-
April 6th, 2009, 10:00 PM
#21
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
-
April 6th, 2009, 10:02 PM
#22
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??
-
April 6th, 2009, 10:04 PM
#23
Re: RowDataBound(:
 Originally Posted by BabyAngel
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)
-
April 6th, 2009, 10:06 PM
#24
Re: RowDataBound(:
 Originally Posted by BabyAngel
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.
-
April 6th, 2009, 10:09 PM
#25
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??
-
April 6th, 2009, 10:31 PM
#26
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..
-
April 6th, 2009, 10:44 PM
#27
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??
-
April 7th, 2009, 12:31 AM
#28
Re: RowDataBound(:
1 is NOT a Double, which is a problem. You can use a variable, or convert it. Look up TryCast()
-
April 7th, 2009, 02:36 AM
#29
Re: RowDataBound(:
erm i kind of dont get what you saying..
-
April 7th, 2009, 09:09 AM
#30
Re: RowDataBound(:
 Originally Posted by BabyAngel
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?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|