Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Updaing a table; Numeric Field

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-10-29 : 21:14:19
John writes "I am writing an ASP include file to handle internal counter values. I am getting the following error.

sql statement = UPDATE Counters SET countervalue = 4 WHERE countername = 'Suggestions'


ADODB.Recordset error '800a0bb9'

The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another.

Heres the function :

function GetNextCounterValue(ServerName,username,Password,TableName,CounterName)

dim db, rs, SQLstr, returnvalue

' set the connection type
Set db = Server.CreateObject("ADODB.Connection")

' open the connection
db.open servername,username,"password"

' Read Current Number
SQLstr = "SELECT CounterValue FROM " & tablename & " WHERE CounterName = " & "'" & CounterName & "'"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open SQLstr, db, 3, 3


returnvalue = rs.fields("countervalue") + 1

response.write(

'Update the Counter
' SQLstr = "UPDATE " & tablename & " SET countervalue = " & returnvalue & " WHERE countername = " & "'" & countername & "'"
SQLstr = "UPDATE " & tablename & " SET countervalue = 4 " & " WHERE countername = " & "'" & countername & "'"

response.write(SQLstr)

Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open SQLstr, conn, 3, 3


'close connection
db.close

end function
"
   

- Advertisement -