I am working with the following code:
If chkApproximately.Checked Then
'.Item_Title = "~ " & String.Format("{0:N0}", Int32.Parse(Me.txtQuantity.Text)) & " " & IIf(Me.ddlUnits.Text = "Piece(s)", "", Me.ddlUnits.Text & " of ") & Me.ddlCategory.SelectedItem.Text.Replace("-", "").Trim 'txtItem_Title.Text.Trim
.Item_Title = "~ " & String.Format("{0:N0}", Me.txtQuantity.Text) & " " & IIf(Me.ddlUnits.Text = "Piece(s)", "", Me.ddlUnits.Text & " of ") & Me.ddlCategory.SelectedItem.Text.Replace("-", "").Trim 'txtItem_Title.Text.Trim
Else
.Item_Title = String.Format("{0:N0}", Me.txtQuantity.Text) & " " & IIf(Me.ddlUnits.Text = "Piece(s)", "", Me.ddlUnits.Text & " of ") & Me.ddlCategory.SelectedItem.Text.Replace("-", "").Trim 'txtItem_Title.Text.Trim
End If
When I run the aspx page on the web server, provide values and submit the form, I receive the error message stated in the question header. Can someone explain why this is happening and provide some suggested solutions?
Thanks,
Sid
Guessing.. try '+' instead of '&'
Related
I am getting this error whenever I try to run my project although the column isn't of type system.string. I have a page that is coded the same way with different numbers and it doesn't give me this error. This is my SQL string:
MyCompSqlString = "SELECT (KAIPRDDTA.F4102LA.IBPRP6)ColOne, (KAIPRDCOM.F0005.DRDL01)ColTwo, COUNT(KAIPRDDTA.F42119LA.SDSOQS*.01)ColThree, SUM(KAIPRDDTA.F42119LA.SDAEXP*.01*CXCRR)ColFour, count(SDDOC)ColFive, SUM(KAIPRDDTA.F42119LA.SDSOQS*.01)ColSix "
MyCompSqlString += "FROM KAIPRDDTA.F42119LA, KAIPRDDTA.F55311, KAIPRDCOM.F0005, KAIPRDDTA.F0015, KAIPRDDTA.F4102LA"
MyCompSqlString += "WHERE DRSY = '41' AND DRRT = '01' AND TRIM(DRKY) = IBPRP6 AND KAIPRDDTA.F42119LA.SDITM = KAIPRDDTA.F4102LA.IBITM AND KAIPRDDTA.F42119LA.SDMCU = KAIPRDDTA.F4102LA.IBMCU AND KAIPRDDTA.F42119LA.SDSLSM = KAIPRDDTA.F55311.TERR AND (KAIPRDDTA.F42119LA.SDIVD >= " & SDJ & ") AND (KAIPRDDTA.F42119LA.SDIVD <= " & EDJ & ") AND "
MyCompSqlString += "(KAIPRDDTA.F42119LA.SDSLSM > 0) AND (KAIPRDDTA.F42119LA.SDGLC NOT IN ('FT60', 'TXTX', 'IN20', 'INSP', 'INWC', 'INWR', 'INWS','',' ')) AND "
MyCompSqlString += "(trim(KAIPRDDTA.F42119LA.SDLNTY) NOT IN ('T', 'F', 'TX', 'TA', 'TS', 'RF', 'RP','BC')) AND (KAIPRDDTA.F42119LA.SDNXTR <> '999') AND (KAIPRDDTA.F42119LA.SDDCTO not in ('ST','CR','SR')) "
MyCompSqlString += "AND (KAIPRDDTA.F55311.VIEWID = '" & MyView & "') AND (SDAN8 <> 24157 and SDAN8 <> 152) AND ((SDTRDJ-1)=CXEFT) AND (SDBCRC=CXCRCD) AND (CXCRDC ='USD')"
MyCompSqlString += "GROUP BY KAIPRDDTA.F4102LA.IBPRP6, KAIPRDCOM.F0005.DRDL01"
and this is my summary row:
<ig:SummaryRow EmptyFooterText="" FormatString=" {1}" ShowSummariesButtons="false">
<ColumnSummaries>
<ig:ColumnSummaryInfo ColumnKey="ColThree">
<Summaries>
<ig:Summary SummaryType="Sum" />
</Summaries>
</ig:ColumnSummaryInfo>
<ig:ColumnSummaryInfo ColumnKey="ColFour">
<Summaries>
<ig:Summary SummaryType="Sum" />
</Summaries>
</ig:ColumnSummaryInfo>
<ig:ColumnSummaryInfo ColumnKey="ColFive">
<Summaries>
<ig:Summary CustomSummaryName="100.00%" />
</Summaries>
</ig:ColumnSummaryInfo>
<ig:ColumnSummaryInfo ColumnKey="ColTwo">
<Summaries>
<ig:Summary CustomSummaryName="Totals:" />
</Summaries>
</ig:ColumnSummaryInfo>
</ColumnSummaries>
Does anyone have any suggestions as to why it is giving me this error? Let me know if you need any more information and I will update my question. Thanks in advance for your responses
You have a group which is NULL. This error means not all of the values are integer. So this query must produce a NULL as a value on some of the rows.
I'm getting a syntax error in my UPDATE statement, but I'm not sure where exactly it is. Here's my code:
strSelected = "UPDATE CFRRR SET assignedby = " & Me.cmbassignedby.Column(1) & ", assignedto = " & _
Me.cmbassignedto.Column(2) & ", Dateassigned = " & Now() & ", actiondate = " & _
Now() & ", Workername = " & Me.cmbassignedto.Column(2) & ", WorkerID = " & _
Me.cmbassignedto.Column(1) & " WHERE CFRRRID In ( " & strSelected & " );"
CurrentDb.Execute strSelected
It's most likely because of the Now() function, which also prints the current time (seperated with a space) - hence the syntax error. Try to surround them with single quotation marks.
You can also print out the SQL Statement
Debug.Print strSelected to see what you have concatenated...
I am getting some errors on my classic asp website. When the website runs for the first time it sometimes does an Internal Server Error. Then a refresh would fix it. I decided to check my IIS logs to see what the problem is but i can't interpret it. Here is the log line
2013-12-09 15:29:00 xx.xx.xx.xx GET / |37|80070005|Access_is_denied.__ 80 - xx.xxx.xx.xx Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/31.0.1650.63+Safari/537.36 500 0 0 702
How about setup custom pages for handle 500 and 500 100 errors?
Create some folder, let's say D:\InetPub\Web01\Err\
Add IUSR_Web01 user with write permission
In IIS for Web01 web site (sample for IIS 6.0)
Put following code in file 500.asp and 500100.asp
Option Explicit
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = #Jan 31,2000 12:30:00#
Response.Clear
Dim FS, TF, N, ASPErr
N = Now
Set ASPErr = Server.GetLastError()
Set FS = CreateObject ("Scripting.FileSystemObject")
Set TF = FS.CreateTextFile ("D:\InetPub\1click.lv\Err\500 " & "Error" & Right ("0" & Year (N), 4) & Right ("0" & Month (N), 2) & Right ("0" & Day (N), 2) & "_" & Right ("0" & Hour (N), 2) & Right ("0" & Minute (N), 2) & Right ("0" & Second (N), 2) & ".txt", True, False)
TF.Write MyErrorInfo (ASPErr, False, False, "1click.lv", "")
TF.Close
Set FS = Nothing
Response.Write MyErrorInfo (ASPErr, True, True, "1click.lv", "zam#1click.lv")
Err.Clear
The function:
Function MyErrorInfo (ASPErr, AsHTML, ShowContactInfo, WebTitle, AdminEmail)
Dim Result
Result = ""
If AsHTML = True Then
Result = Result & "<html><head><title>Error occur</title></head><body><font face=Verdana size=2>"
If (ShowContactInfo = True) Then
Result = Result & "<p align=center>"
Result = Result & "<font size=4>"
Result = Result & "<font color=""#008000"">" & WebTitle & "</font><br>"
Result = Result & "<font color=""#800000"">500 Error occur</font><br>"
Result = Result & "Please contact us by email at " & AdminEmail & " and inform about this error<br><br>"
Result = Result & "Thank you for your support!"
Result = Result & "</font>"
Result = Result & "</p>"
End If
Result = Result & "<hr>"
Result = Result & "Error number: <b>" & ASPErr.Number & "</b><br>"
Result = Result & "Error source: <b>" & ASPErr.Source & "</b><br>"
Result = Result & "Error description: <b>" & ASPErr.Description & "</b><br>"
Result = Result & "Error line: <b>" & ASPErr.Line & "</b><br>"
Result = Result & "Client IP: <b>" & Request.ServerVariables ("REMOTE_ADDR") & "</b><br>"
Result = Result & "Client Browser: <b>" & Request.ServerVariables ("HTTP_USER_AGENT") & "</b><br>"
Result = Result & "Client Referer: <b>" & Request.ServerVariables ("HTTP_REFERER") & "</b><br>"
Result = Result & "Path: <b>" & Request.ServerVariables ("PATH_INFO") & "</b><br>"
Result = Result & "Request method: <b>" & Request.ServerVariables ("REQUEST_METHOD") & "</b><br>"
Result = Result & "Request FORM: <b>" & Request.Form & "</b><br>"
Result = Result & "Request QUERY: <b>" & Request.QueryString & "</b><br>"
Result = Result & "<hr>"
Result = Result & "</font></body></html>"
Else
Result = Result & WebTitle & vbCrLf
Result = Result & "Error number: " & ASPErr.Number & vbCrLf
Result = Result & "Error source: " & ASPErr.Source & vbCrLf
Result = Result & "Error description: " & ASPErr.Description & vbCrLf
Result = Result & "Error line: " & ASPErr.Line & vbCrLf
Result = Result & "Client IP: " & Request.ServerVariables ("REMOTE_ADDR") & vbCrLf
Result = Result & "Client Browser: " & Request.ServerVariables ("HTTP_USER_AGENT") & vbCrLf
Result = Result & "Client Referer: " & Request.ServerVariables ("HTTP_REFERER") & vbCrLf
Result = Result & "Path: " & Request.ServerVariables ("PATH_INFO") & vbCrLf
Result = Result & "Request method: " & Request.ServerVariables ("REQUEST_METHOD") & vbCrLf
Result = Result & "Request FORM: " & Request.Form & vbCrLf
Result = Result & "Request QUERY: " & Request.QueryString & vbCrLf
End If
MyErrorInfo = Result
End Function
I'm calling the ExecuteQuery method of my DataContext object. I expect a String and an Integer for each row as a result but all my values are nothing and 0 when I run the ToList function. All my results should be different strings and numbers. My query runs perfectly if I run it directly, but ExecuteQuery returns garbage instead of valid results. What can be the cause of this?
Thank you in advance.
Edit:
public function something as List(of Pair(of String, Integer))
Dim c As TTDataContext = ContextFactory.CreateDataContext()
Dim startValueLen = CStr(StartValue).Length
Dim query As String = "select top " & CStr(Limit) & " case " &
" when WONum like '0000%' then SUBSTRING(WONum, 5, Len(WONum) - 4) " &
" when WONum like '000%' then SUBSTRING(WONum, 4, Len(WONum) - 3) " &
" when WONum like '00%' then SUBSTRING(WONum, 3, Len(WONum) - 2) " &
" when WONum like '0%' then SUBSTRING(WONum, 2, Len(WONum) - 1) " &
" else WONum " &
" end as retVal, " &
" case " &
" when WONum like '0000%' then 1 " &
" when WONum like '000%' then 2 " &
" when WONum like '00%' then 3 " &
" when WONum like '0%' then 4 " &
" else LEN(WONum) " &
" end as retLen " &
" from TblWorkOrder " &
" where CompanyID = " & CStr(CompanyID) & " and LEN(WONum) >= " & CStr(startValueLen) & " and (WONum > '" & CStr(StartValue) & "' or LEN(WONum) > " & CStr(startValueLen) & ") " &
" order by retLen, retVal"
Dim temp = c.ExecuteQuery(Of Pair(Of String, Integer))(query)
Return temp.ToList
End Function
The cause of the problem was that my Pair class had a First and a Second property and I didn't return my results as First and as second. So the solution for the problem is to return the first value as First and the second value as Second instead of retVal and retLen.
I created an application to show a press release once the target date and time have been reached and wanted to know if this is getting the time from the server or the client because I'd like to use the server's time so that someone doesn't just change their clock in order to see it.
Here's my code:
<%
dim strDate
dim strTime
dim strTarget_time
dim strTarget_date
dim strBreak
dim strRuleBreak
dim strToday
strDate = Date()
strTime = Time()
strright_now = Now()
strTarget_time = "3:27:00 PM"
strTarget_date = "6/26/2012"
strBreak = "<br />"
strRuleBreak = "<br /><hr><br />"
strToday = Now()
response.write("<h2>TEST VARIABLES</h2>")
response.write("<p><strong>Today's date:</strong> " & strDate & strBreak)
response.write("<strong>Current time:</strong> " & strTime & strBreak)
response.write("<strong>Target date:</strong> " & strTarget_date & strBreak)
response.write("<strong>Target time:</strong> " & strTarget_time & "</p>")
response.write(strRuleBreak)
'TIME TESTER
response.write("<h2>TIME TESTER</h2>")
response.write("<p><nobr>Testing to see if it is past the target time of: " & strTarget_time & "</nobr></p>")
if strTime >= cdate(strTarget_time) then
response.write("<p>Yes, it is now " & Now() & ", which <strong>IS</strong> past the target time of: " & strTarget_time & "</p>")
else
response.write("<p>No, it is now " & Now() & ", which is <strong>NOT</strong> past the target time of: " & strTarget_time & "</p>")
end if
response.write(strRuleBreak)
'DATE TESTER
response.write("<h2>DATE TESTER</h2>")
response.write("<p><nobr>Testing to see if it is past the target date of: " & strTarget_date & "</nobr></p>")
if strToday >= cdate(strTarget_date) then
response.write("<p>Yes, it is now " & Now() & ", which <strong>IS</strong> past the target date of: " & strTarget_date & "</p>")
else
response.write("<p>No, it is now " & Now() & ", which is <strong>NOT</strong> past the target date of: " & strTarget_date & "</p>")
end if
response.write(strRuleBreak)
'DATE AND TIME TESTER
response.write("<h2>DATE AND TIME TESTER</h2>")
response.write("<p><nobr>Testing to see if it is past the target of: " & strTarget_date & " - " & strTarget_time & "</nobr></p>" & strBreak)
if strToday >= cdate(strTarget_date) AND strTime >= cdate(strTarget_time) then
response.write("<p>Yes, it is now " & Now() & ", which <strong>IS</strong> past the target of: " & strTarget_date & " - " & strTarget_time & "</p>")
else
response.write("<p>No, it is now " & Now() & ", which is <strong>NOT</strong> past the target of: " & strTarget_date & " - " & strTarget_time & "</p>")
end if
response.write(strRuleBreak)
%>
So in this case, if the time and date is AFTER 6/26/2012 3:27 PM, then the section will show. I'm mainly asking because I want to clarify whether this is client or server side time being used.
This is going to be server-side, as that is where ASP code is executed. In order to get the client-side datetime, you would need to use a script to run in the browser - generally JavaScript.