Request Type Mismatch error

Batch, ASP, JScript, Kixtart, etc.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
simflex
Posts: 26
Joined: Tue Jun 22, 2010 1:47 am

Request Type Mismatch error

Post by simflex » Tue Jun 22, 2010 1:53 am

Hello experts,

I can't express enough how delighted to have discovered this forum.

I just dabbled in hta programming and I am having all kinds of fits.
First connection to sql server which was working fine with ADO, would not work with hta but I seem to have solved that.

Currently, I am getting an error that says, "Type mismatch: Request"

This is caused by this line (bolded).

sub getdata
If Request("POSTBACK") = "NEWCASE" Then
' new case requested client = Trim(Request("clientid")) casename = Trim(Request("casename")) casetype = Trim(Request("casetype"))
If client <= 0 Then ' only generate a new client id if we *NEED* to!!!!! SQL = "Set Nocount on; " _ & " Insert INTO Clients (ClientName) VALUES ('" & Replace(Request("newclientid"),"'","''") & "');" _ & " Select @@identity; " _ & " set nocount off" 'response.write SQL 'response.end ' Run the query and create resulting recordset. Set RS = Conn.Execute(SQL) client = RS(0) RS.closeEnd If
SQL = "INSERT INTO Cases (clientid,casename,casetype) " _ & " VALUES(" & client & ",'" & casename & "','" & casetype & "')" ' response.write SQL & "<br>" ' response.end
conn.Execute SQL SQL = "SELECT @@IDENTITY" Set RS = conn.Execute(SQL) caseid = RS(0) ' response.write caseid& "<br>" ' response.end RS.CloseEnd If
If Request("POSTBACK") = "ASSIGNCASE" Then caseid = Trim(Request("caseid")) JudgeCode = Trim(Request("Judge")) SQL = "UPDATE Cases SET JudgeCode = '" & JudgeCode & "' WHERE caseid = " & caseid conn.Execute(SQL)
'**** Judge must be available for new assignment until one is assigned.SQL = "SELECT isTransferCase from Cases WHERE caseid = " & caseidSet RS = conn.Execute(SQL) If isTransferCase <> 1 Then SQL = "UPDATE Judges SET IsTakingNewCases = 0 WHERE JudgeCode = '" & JudgeCode & "' " conn.Execute(SQL) Else End IfEnd If
'Now shows us how many more judges need to be assigned a case.SQL = "SELECT COUNT(*) As RemainingCases from Judges WHERE isTakingNewCases = 1 "Set RS = conn.Execute(SQL)If not RS.eof then CasesLeft = RS("RemainingCases")End If
' see if there are any cases pending that need a Judge assigned to them:SQL = "SELECT TOP 1 CaseID, ClientID, casename, casetype FROM Cases WHERE Coalesce(JudgeCode,'0') = '0' ORDER BY CaseID "'Response.write sql & "<br>"'Response.endSet RS = conn.Execute(SQL)If Not RS.EOF Then ' aha! have a case that needs assignment caseid = RS("caseID") clientid = RS("clientID") casename = RS("casename") casetype = RS("casetype")
' now, does this client have any cases assigned to any Judge? SQL = "SELECT TOP 1 JudgeCode FROM Cases WHERE clientID = " & clientid & " AND Coalesce(JudgeCode,'0') <> '0' " 'Response.write sql & "<br>" 'Response.end
Set RS = conn.Execute(SQL) If Not RS.EOF Then lcode = RS(0) ' yes! already has this code assigned SQL = "UPDATE Cases SET JudgeCode = '" & lcode & "', isTransferCase = 1 WHERE caseid = " & caseid conn.Execute SQL 'SQL = "UPDATE Judges SET IsTakingNewCases = 0 WHERE JudgeCode = '" & lcode & "' " 'conn.Execute SQL
Response.Write "<h3>Assigned " & lcode & " to case " & caseid & " for client " & clientid & "</h3>" _ & "<br/>Case name: " & casename & "<br/>Case type: " & casetype _ & "<br/>(same client as a prior case)</br></hr>" & vbNewLine Else ' if here, this is first case for this client...so find an available judge: SQL = "SELECT TOP 1 JudgeCode, JudgeName FROM Judges " _ & " WHERE IsTakingNewCases = 1 " _ & " ORDER BY NEWID()" 'Response.write sql & "<br>" 'Response.end Set RS = Conn.Execute(SQL)
'******* The beginning of deprecated code snippets ***************** '* SQL = "SELECT JudgeCode, JudgeName FROM Judges " _ * '* & " WHERE JudgeCode NOT IN (SELECT JudgeCode FROM Cases) " _* '* & " ORDER BY JudgeName " * '* Response.write sql & "<br>" * '* Response.end * '* Set RS = Conn.Execute(SQL) * '* * '* SQL = "SELECT Judges.JudgeCode, JudgeName " & _ * '* "FROM Judges " & _ * '* "LEFT JOIN Cases ON Cases.JudgeCode = Judges.JudgeCode " & _ * '* "WHERE Cases.CaseId IS NULL " & _ * '* "ORDER BY JudgeName " * '* * '* SQL = "SELECT j.JudgeCode, j.JudgeName " & _ * '* "FROM Judges j " & _ * '* "LEFT JOIN Cases c ON c.JudgeCode = j.JudgeCode " & _ * '* "WHERE c.JudgeCode IS NULL " & _ * '* "ORDER BY j.JudgeName" * '* Set RS = Conn.Execute( SQL ) * '* * '* SQL = "SELECT j.JudgeCode, j.JudgeName " & _ * '* "FROM Judges j " & _ * '* "LEFT JOIN Cases c ON c.JudgeCode = j.JudgeCode " & _ * '* "WHERE c.JudgeCode is null AND j.IsTakingNewCases = 1 " & _ * '* "ORDER BY j.JudgeName" * '******* The End of deprecated code snippets ***********************
If RS.EOF then 'No Judges Available, time to start over
Response.Write "Reloaded Judges Wheel..."
SQL = "INSERT INTO CasesArchive (CaseID, ClientId, JudgeCode, CaseName, CaseType) " & _ "SELECT CaseID, ClientId, JudgeCode, CaseName, CaseType FROM Cases WHERE JudgeCode <> '0'" 'Response.Write "DEBUG SQL: " & SQL & "<HR>" 'Response.end Set RS = Conn.Execute(SQL)
SQL = "UPDATE Judges SET IsTakingNewCases = 1" 'response.write strsql 'response.end Set RS = Conn.Execute(SQL)
SQL = "DELETE FROM Cases WHERE isTransferCase <> 1" 'response.write strsql 'response.end Set RS = Conn.Execute(SQL) 'Clean up
'call above query again SQL = "SELECT TOP 1 JudgeCode, JudgeName FROM Judges " _ & " WHERE IsTakingNewCases = 1 " _ & " ORDER BY NEWID()" Set RS = Conn.Execute(SQL) End If
'******* let user know if there are any judges left to be assigned a case. ********* If cint(CasesLeft) > 0 then Response.Write "<FONT FACE='ARIAL' SIZE='2' COLOR='GREEN'><B> " & CasesLeft & " judges remaining to be assigned a new case</B></FONT>" else Response.Write "<FONT FACE='ARIAL' SIZE='2' COLOR='RED'><B> " & CasesLeft & " judges left. This round of assignment is complete.</B></FONT>" End if End if End Ifend sub
I am an extreme newbie to hta. Please, please help.

Thanks a lot in advance

--sim

User avatar
simflex
Posts: 26
Joined: Tue Jun 22, 2010 1:47 am

Request Type Mismatch error

Post by simflex » Tue Jun 22, 2010 4:38 am

thank you very much for your response.

I have used ASP and .net extensively; just not familiar with HTA - something I am definitely interedted in just because of look and feel.

I am definitely certain that is an alternative in HTA to using the request object. That's what I was hoping for.
So, rather than :

<input type="hidden" name="POSTBACK" value="NEWCASE" />, there should be an HTA workaround to it, I am sure. I just have looked hard enough I suppose.

User avatar
rasimmer
Posts: 182
Joined: Fri Jan 30, 2009 12:37 am

Request Type Mismatch error

Post by rasimmer » Tue Jun 22, 2010 5:59 am

Is it GetObjectByID or GetElementByID?

User avatar
jvierra
Posts: 13479
Joined: Tue May 22, 2007 9:57 am
Contact:

Request Type Mismatch error

Post by jvierra » Tue Jun 22, 2010 6:17 am

Is it GetObjectByID or GetElementByID?

Sorry - GetElementByID. I'm working on another with GetObject and got mixed up.


Locked