p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: SQL+ASP Update using TWO where Params


Message #1 by "David Gerlach" <iluvwilai@h...> on Sun, 01 Apr 2001 19:55:42
without going to a lot of details, it looks like FormNbr is a numeric data type, but
you are tellin access that it's a string, by using the ' marks around the value. 
try taking out the tic marks around the value and see what happens.

hope this helps,

john

--- David Gerlach <iluvwilai@h...> wrote:
> I am trying to update a record, but I am getting an error, Here is the code:
> 
>  <% 
>  strSql6 = "UPDATE tblAttach SET MasterRecordID = '" & strMaster & "', FormNbr='"
> & intForm & "', GrpName1 ='" & strGrpName1 & "', ConInfo1='" & strConInfo1 & "',
> GnsatBs1='" & strGnsatbs1 & "', GnCapad1='"  & strGncapad1 & "', GnForpr1='" &
> strGnforpr1 &  "', GnConlo1='" & intGnconlo1 &  "', GnPwmgt1=" & blnGnpwmgt1 & ",
> GnMaxa1=" & blnGnmaxa1 & ", GnPwle1='" & intGnpwle1 & "', GnAnr1=" &_
>  blnGnanr1 & ", GnSadd1=" & blnGnsadd1 & ", GnFlti1='"  & strGnflti1 & "',
> GnFilter1='" & strGnfilter1 & "', GnApn1='" & strGnApn1 & "', UbpCr1='" &
> strUbpCr1 & "', UbpEr1='" & strUbpEr1 & "', UbpEa1='" &_
>  strUbpEa1 & "', SpltTun1="  & blnSplttun1 & ", StNoww1='" & strStNoww1 & "',
> ClSelCo1='" & strClSelCo1 & "', AuthOpt1='" & strAuthOpt1 & "', AuthDsc1='" &
> strAuthDsc1 & "', RadAuth1='" & strRadAuth1 &_
>   "', IpGrp1='" & strIpgrp1 & "', IpGrppw1='" & strIpgrppw1 & "', IpEncop1='" &
> strIpencop1 & "', PerForSec1='" & strPerForSec1 & "', IkeEncry1='" & strIkeEncry1
> & "', IpsecFlo1='" & strIpsecFlo1 & "', IpsecCac1='" & strIpsecCac1 & "',
> IpsecAnt1='" & strIpsecAnt1 & "', IpsecNet1='" & strIpsecNet1 & "', KeepAlive1=" &
> blnKeepalive1 & _
> ", KeepInt1='" & strKeepInt1 & "', MaxRetry1='" & intMaxretry1 & "', CssPw1='" &
> strCssPw1 & "', IpSsact1='" & strIpSsact1 & "', IpApws1=" & blnIpapws1 & ",
> IpCompr1=" & blnIpcompr1 & ", RekeyTo1='" & strRekeyTo1 & "', RekeyDc1='"  &
> strRekeyDc1 & "', IpsecDn1='" & strIpsecDn1 & "', Ipsec1Dns1='" &_
>  strIpsec1Dns1 &  "', Ipsec2Dns1='" & strIpsec2Dns1 & "', Ipsec1Win1='" &
> strIpsec1Win1 & "', Ipsec2Win1='" & strIpsec2Win1 & "', MinVer1='" & strMinVer1 &
> "', NcAction1='" & strNcAction1 & "', NcMessage1='" & strNcMessage1 & "',
> NcFilter1='" & strNcFilter1 & "', GnClip1='" & strGnClip1 &_
>  "', TransMore1='" & strTransMore1 & "', IpBanner1='" & strIpBanner1 & "'  WHERE
> (MasterRecordID = '" & strMaster & "') AND (FormNbr='" & intForm & "')" 
>  
>  
>  'Updating the info for tblAttach
>  
>  Set objAttach = Server.CreateObject("ADODB.Command")
>  objAttach.ActiveConnection = strConnect 
>  objAttach.CommandText=strSql6
>  objAttach.CommandType=adCmdText
>  objAttach.Execute intNoOfRecords6
>  Response.Write "This Update for tblAttach command has affected  " & _ 
>     intNoOfRecords6 & " records<BR><BR>"
>  Set objAttach = Nothing 
>  %>
>  
>  The error I get is:
>  
> Error Type:
> Microsoft JET Database Engine (0x80040E07)
> Data type mismatch in criteria expression.
> /tpd/update/mnsipsec.asp, line 813
>  
> When I take away the " AND (FormNbr='" & intForm & "')"  " It works fine. But I
> need to update the record 
> With the correct MasterRecordID AND Form Number. Any suggestions?
>  
> Thanks in advance
> David
> 
 
John Pirkey 
MCSD 
John@S... 
http://www.stlvbug.org

  Return to Index