| Author |
Topic  |
|
|
fhtapia
Starting Member
9 Posts |
Posted - 06/22/2004 : 13:24:30
|
the purpose of the following excersise is to update a whole bunch of addresses in my database,
I have the following vbscript which works just fine: dim ht,a,c,s,z,f,x a="2900 Featherstone Road" c="auburn hills" s="mi" z="93004" set ht = createobject("haastele.address") x=ht.validateaddress(a,c,s,z,f) msgbox x & vbcrlf & a & vbcrlf & c & vbcrlf & s & vbcrlf & z & vbcrlf & f
I could simply open a recordset and excersise the following script against my server, but I'd like to do it all server based instead of opening up such a large recordset.
I've tried scripting it out in QA but this is my current errors: Error Occurred Calling Object: ODSOLE Extended Procedure sp_OAMethod usage: ObjPointer int IN, MethodName varchar IN [, @returnval <any> OUT [, additional IN, OUT, or BOTH params]] What?, thanks in advance for your help :)
----SCRIPT------- DECLARE @object int DECLARE @output varchar(255) DECLARE @hr int
Declare @a varchar(255) Declare @c varchar(255) Declare @s varchar(255) Declare @z varchar(255) Declare @f int Declare @x bit
DECLARE @src varchar(255), @desc varchar(255) --Create the object EXEC @hr = sp_OACreate 'haastele.address', @object OUT, 4
--Set Properties EXEC @hr = sp_OASetProperty @object, '2900 FeatherStone Rd',@a EXEC @hr = sp_OASetProperty @object, 'auburn hills',@c EXEC @hr = sp_OASetProperty @object, 'mi',@s EXEC @hr = sp_OASetProperty @object, '93004',@z EXEC @hr = sp_OASetProperty @object, 0,@f
--Call the object's property and return the value EXEC @hr = sp_OAMethod @object, 'validateaddress', @x OUT
IF @hr <> 0 BEGIN EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT PRINT 'Error Occurred Calling Object: ' + @src + ' ' + @desc -- RETURN END
PRINT @x PRINT @a PRINT @f
--Destroy the object EXEC @hr = sp_OADestroy @object
|
|
|
nr
SQLTeam MVY
United Kingdom
12543 Posts |
Posted - 06/22/2004 : 13:44:50
|
Is the returnvalue really a bit? try it as an int. Is it a returnvalue rather than an output parameter?
You have a property of the haastele.address object named '2900 FeatherStone Rd'?
try just
EXEC @hr = sp_OAMethod @object, 'validateaddress', @x OUT, '2900 FeatherStone Rd', 'auburn hills', 'mi', '93004', 93004 or replace with variables but set the variables first.
========================================== Cursors are useful if you don't know sql. DTS can be used in a similar way. Beer is not cold and it isn't fizzy. |
 |
|
|
fhtapia
Starting Member
9 Posts |
Posted - 06/22/2004 : 15:35:35
|
| THAT WAS IT :D, thanks :D |
 |
|
| |
Topic  |
|
|
|