ASPSQLVB
02-16-2007, 06:05 PM
I am running into an error. This code was working before and now its not.
I am trying to take the TOP 3 HIGHEST TotalWeight values from a table and insert them into another table.
I can insert the First row of data but when it comes to inserting the next row that's when the error occurs.
Here is the ERROR I am getting.
ADODB.Command error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/CheckCustomerExpiration.asp, line 200
I pointed out the ERROR Line.
If AnglersPerTeam = "Double" Then
Dim RS4,STRSQL4,RS4_FishAngler2,STRSQL4_FishAngler2
Set RS4 = Server.CreateObject("ADODB.Recordset")
STRSQL4 = "SELECT TOP 3 MAX(TotalWeight.TotalWeight) AS TotalWeight, COUNT(*) AS Expr3, COUNT(*) AS Expr4, TotalWeight.TotalWeightId,BigFish.BigFish, FishAngler.Bio, FishAngler.AnglerPhoto, FishAngler.PegNumber, FishAngler.TeamName,FishAngler.FirstName, FishAngler.LastName, FishAngler.State, FishAngler.Country, FishAngler.Sponsor,FishAngler.SponsorWebAddress, FishAngler.AnglerPassword, TotalWeight.TotalWeight AS Expr1, FishAngler.FishId FROM BigFish INNER JOIN FishAngler ON BigFish.FishId = FishAngler.FishId INNER JOIN TotalWeight ON FishAngler.FishId = TotalWeight.FishId GROUP BY TotalWeight.TotalWeightId, BigFish.BigFish, FishAngler.Bio, FishAngler.AnglerPhoto, FishAngler.PegNumber, FishAngler.TeamName, FishAngler.FirstName, FishAngler.LastName, FishAngler.State, FishAngler.Country, FishAngler.Sponsor, FishAngler.SponsorWebAddress, FishAngler.AnglerPassword, TotalWeight.TotalWeight, FishAngler.FishId ORDER BY MAX(TotalWeight.TotalWeight) DESC"
RS4.Open STRSQL4,Conn
Do Until RS4.EOF
Set RS4_FishAngler2 = Server.CreateObject("ADODB.Recordset")
STRSQL4_FishAngler2 = "Select * from FishAngler2 Where PegNumber=" & RS4("PegNumber")
RS4_FishAngler2.Open STRSQL4_FishAngler2,Conn,adOpenKeyset,adLockOptimistic,adCmdText
Dim RS_Fish,STRSQL_Fish
Set RS_Fish = Server.CreateObject("ADODB.Recordset")
STRSQL_Fish = "Select FishCount from Fish Where FishId=" & RS4("FishId")
RS_Fish.Open STRSQL_Fish,Conn,adOpenStatic,adLockOptimistic,adCmdText
Set Comm2 = Server.CreateObject("ADODB.Command")
With Comm2
.ActiveConnection = Conn
.CommandText = "NewExpiredCarpAnglers"
.CommandType = adCmdStoredProc
End With
'ADD THE TOP 3 ANGLERS TO THE NEW TABLES
Comm2.Parameters.Append Comm2.CreateParameter("FishId",adInteger,adParamReturnValue,4)
Dim Bio1,Bio2
Bio1 = CheckData(RS4("Bio"))
Bio2 = CheckData(RS4_FishAngler2("Bio"))
Comm2.Parameters.Append Comm2.CreateParameter("@Bio1",adVarChar,adParamInput,3000,Bio1)
Comm2.Parameters.Append Comm2.CreateParameter("@Bio2",adVarChar,adParamInput,3000,Bio2)
Dim AnglerPhoto1,AnglerPhoto2
AnglerPhoto1 = RS4("AnglerPhoto")
AnglerPhoto2 = RS4_FishAngler2("AnglerPhoto")
Comm2.Parameters.Append Comm2.CreateParameter("@AnglerPhoto1",adVarChar,adParamInput,100,AnglerPhoto1)
Comm2.Parameters.Append Comm2.CreateParameter("@AnglerPhoto2",adVarChar,adParamInput,100,AnglerPhoto2)
Comm2.Parameters.Append Comm2.CreateParameter("@TeamName",adVarChar,adParamInput,50,RS4("TeamName"))
Comm2.Parameters.Append Comm2.CreateParameter("@PegNumber",adInteger,adParamInput,4,RS4("PegNumber"))
Dim FirstName1,FirstName2
FirstName1 = RS4("FirstName")
FirstName2 = RS4_FishAngler2("FirstName")
Comm2.Parameters.Append Comm2.CreateParameter("@FirstName1",adVarChar,adParamInput,50,FirstName1)
Comm2.Parameters.Append Comm2.CreateParameter("@FirstName2",adVarChar,adParamInput,50,FirstName2)
Dim LastName1,LastName2
LastName1 = RS4("LastName")
LastName2 = RS4_FishAngler2("LastName")
Comm2.Parameters.Append Comm2.CreateParameter("@LastName1",adVarChar,adParamInput,50,LastName1)
Comm2.Parameters.Append Comm2.CreateParameter("@LastName2",adVarChar,adParamInput,50,LastName2)
Dim State1,State2
State1 = RS4("State")
State2 = RS4_FishAngler2("State")
Comm2.Parameters.Append Comm2.CreateParameter("@State1",adChar,adParamInput,10,State1)
Comm2.Parameters.Append Comm2.CreateParameter("@State2",adChar,adParamInput,10,State2)
Comm2.Parameters.Append Comm2.CreateParameter("@Country",advarChar,adParamInput,50,RS4("Country"))
Comm2.Parameters.Append Comm2.CreateParameter("@Sponsor",adVarChar,adParamInput,50,RS4("Sponsor"))
Comm2.Parameters.Append Comm2.CreateParameter("@SponsorWebAddress",adVarChar,adParamInput,50,RS4("SponsorWebAddress"))
Comm2.Parameters.Append Comm2.CreateParameter("@NameofEvent",advarChar,adParamInput,50,RS2("NameofEvent"))
Comm2.Parameters.Append Comm2.CreateParameter("@StartDate",adDate,adParamInput,8,RS2("StartDate"))
Comm2.Parameters.Append Comm2.CreateParameter("@LengthofEvent",adInteger,adParamInput,4,RS2("LengthofEvent"))
Dim param
Set param = Comm2.CreateParameter("@BigFish",adDecimal,adParamInput,9,RS4("BigFish"))
param.Precision = 10
param.NumericScale = 2
param.Value = RS4("BigFish")
Comm2.Parameters.Append param
Dim param3
Set param3 = Comm2.CreateParameter("@TotalWeight",adDecimal,adParamInput,9,RS4("TotalWeight"))
param3.Precision = 10
param3.NumericScale = 2
param3.Value = RS4("TotalWeight")
Comm2.Parameters.Append param3
THE ERROR IS HERE ~~~~~~~> Comm2.Parameters.Append Comm2.CreateParameter("@FishCount",adInteger,adParamInput,4,RS_Fish("FishCount"))
Comm2.Execute,,adExecuteNoRecords
dim valueHolder2
valueHolder2 = Comm2.Parameters("FishId")
RS4.MoveNext
Loop
I am trying to take the TOP 3 HIGHEST TotalWeight values from a table and insert them into another table.
I can insert the First row of data but when it comes to inserting the next row that's when the error occurs.
Here is the ERROR I am getting.
ADODB.Command error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/CheckCustomerExpiration.asp, line 200
I pointed out the ERROR Line.
If AnglersPerTeam = "Double" Then
Dim RS4,STRSQL4,RS4_FishAngler2,STRSQL4_FishAngler2
Set RS4 = Server.CreateObject("ADODB.Recordset")
STRSQL4 = "SELECT TOP 3 MAX(TotalWeight.TotalWeight) AS TotalWeight, COUNT(*) AS Expr3, COUNT(*) AS Expr4, TotalWeight.TotalWeightId,BigFish.BigFish, FishAngler.Bio, FishAngler.AnglerPhoto, FishAngler.PegNumber, FishAngler.TeamName,FishAngler.FirstName, FishAngler.LastName, FishAngler.State, FishAngler.Country, FishAngler.Sponsor,FishAngler.SponsorWebAddress, FishAngler.AnglerPassword, TotalWeight.TotalWeight AS Expr1, FishAngler.FishId FROM BigFish INNER JOIN FishAngler ON BigFish.FishId = FishAngler.FishId INNER JOIN TotalWeight ON FishAngler.FishId = TotalWeight.FishId GROUP BY TotalWeight.TotalWeightId, BigFish.BigFish, FishAngler.Bio, FishAngler.AnglerPhoto, FishAngler.PegNumber, FishAngler.TeamName, FishAngler.FirstName, FishAngler.LastName, FishAngler.State, FishAngler.Country, FishAngler.Sponsor, FishAngler.SponsorWebAddress, FishAngler.AnglerPassword, TotalWeight.TotalWeight, FishAngler.FishId ORDER BY MAX(TotalWeight.TotalWeight) DESC"
RS4.Open STRSQL4,Conn
Do Until RS4.EOF
Set RS4_FishAngler2 = Server.CreateObject("ADODB.Recordset")
STRSQL4_FishAngler2 = "Select * from FishAngler2 Where PegNumber=" & RS4("PegNumber")
RS4_FishAngler2.Open STRSQL4_FishAngler2,Conn,adOpenKeyset,adLockOptimistic,adCmdText
Dim RS_Fish,STRSQL_Fish
Set RS_Fish = Server.CreateObject("ADODB.Recordset")
STRSQL_Fish = "Select FishCount from Fish Where FishId=" & RS4("FishId")
RS_Fish.Open STRSQL_Fish,Conn,adOpenStatic,adLockOptimistic,adCmdText
Set Comm2 = Server.CreateObject("ADODB.Command")
With Comm2
.ActiveConnection = Conn
.CommandText = "NewExpiredCarpAnglers"
.CommandType = adCmdStoredProc
End With
'ADD THE TOP 3 ANGLERS TO THE NEW TABLES
Comm2.Parameters.Append Comm2.CreateParameter("FishId",adInteger,adParamReturnValue,4)
Dim Bio1,Bio2
Bio1 = CheckData(RS4("Bio"))
Bio2 = CheckData(RS4_FishAngler2("Bio"))
Comm2.Parameters.Append Comm2.CreateParameter("@Bio1",adVarChar,adParamInput,3000,Bio1)
Comm2.Parameters.Append Comm2.CreateParameter("@Bio2",adVarChar,adParamInput,3000,Bio2)
Dim AnglerPhoto1,AnglerPhoto2
AnglerPhoto1 = RS4("AnglerPhoto")
AnglerPhoto2 = RS4_FishAngler2("AnglerPhoto")
Comm2.Parameters.Append Comm2.CreateParameter("@AnglerPhoto1",adVarChar,adParamInput,100,AnglerPhoto1)
Comm2.Parameters.Append Comm2.CreateParameter("@AnglerPhoto2",adVarChar,adParamInput,100,AnglerPhoto2)
Comm2.Parameters.Append Comm2.CreateParameter("@TeamName",adVarChar,adParamInput,50,RS4("TeamName"))
Comm2.Parameters.Append Comm2.CreateParameter("@PegNumber",adInteger,adParamInput,4,RS4("PegNumber"))
Dim FirstName1,FirstName2
FirstName1 = RS4("FirstName")
FirstName2 = RS4_FishAngler2("FirstName")
Comm2.Parameters.Append Comm2.CreateParameter("@FirstName1",adVarChar,adParamInput,50,FirstName1)
Comm2.Parameters.Append Comm2.CreateParameter("@FirstName2",adVarChar,adParamInput,50,FirstName2)
Dim LastName1,LastName2
LastName1 = RS4("LastName")
LastName2 = RS4_FishAngler2("LastName")
Comm2.Parameters.Append Comm2.CreateParameter("@LastName1",adVarChar,adParamInput,50,LastName1)
Comm2.Parameters.Append Comm2.CreateParameter("@LastName2",adVarChar,adParamInput,50,LastName2)
Dim State1,State2
State1 = RS4("State")
State2 = RS4_FishAngler2("State")
Comm2.Parameters.Append Comm2.CreateParameter("@State1",adChar,adParamInput,10,State1)
Comm2.Parameters.Append Comm2.CreateParameter("@State2",adChar,adParamInput,10,State2)
Comm2.Parameters.Append Comm2.CreateParameter("@Country",advarChar,adParamInput,50,RS4("Country"))
Comm2.Parameters.Append Comm2.CreateParameter("@Sponsor",adVarChar,adParamInput,50,RS4("Sponsor"))
Comm2.Parameters.Append Comm2.CreateParameter("@SponsorWebAddress",adVarChar,adParamInput,50,RS4("SponsorWebAddress"))
Comm2.Parameters.Append Comm2.CreateParameter("@NameofEvent",advarChar,adParamInput,50,RS2("NameofEvent"))
Comm2.Parameters.Append Comm2.CreateParameter("@StartDate",adDate,adParamInput,8,RS2("StartDate"))
Comm2.Parameters.Append Comm2.CreateParameter("@LengthofEvent",adInteger,adParamInput,4,RS2("LengthofEvent"))
Dim param
Set param = Comm2.CreateParameter("@BigFish",adDecimal,adParamInput,9,RS4("BigFish"))
param.Precision = 10
param.NumericScale = 2
param.Value = RS4("BigFish")
Comm2.Parameters.Append param
Dim param3
Set param3 = Comm2.CreateParameter("@TotalWeight",adDecimal,adParamInput,9,RS4("TotalWeight"))
param3.Precision = 10
param3.NumericScale = 2
param3.Value = RS4("TotalWeight")
Comm2.Parameters.Append param3
THE ERROR IS HERE ~~~~~~~> Comm2.Parameters.Append Comm2.CreateParameter("@FishCount",adInteger,adParamInput,4,RS_Fish("FishCount"))
Comm2.Execute,,adExecuteNoRecords
dim valueHolder2
valueHolder2 = Comm2.Parameters("FishId")
RS4.MoveNext
Loop