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.
Author |
Topic |
fhtapia
Starting Member
9 Posts |
Posted - 2004-06-22 : 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,xa="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 & fI 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 intDECLARE @output varchar(255)DECLARE @hr intDeclare @a varchar(255)Declare @c varchar(255)Declare @s varchar(255)Declare @z varchar(255)Declare @f intDeclare @x bitDECLARE @src varchar(255), @desc varchar(255)--Create the objectEXEC @hr = sp_OACreate 'haastele.address', @object OUT, 4--Set PropertiesEXEC @hr = sp_OASetProperty @object, '2900 FeatherStone Rd',@aEXEC @hr = sp_OASetProperty @object, 'auburn hills',@cEXEC @hr = sp_OASetProperty @object, 'mi',@sEXEC @hr = sp_OASetProperty @object, '93004',@zEXEC @hr = sp_OASetProperty @object, 0,@f--Call the object's property and return the valueEXEC @hr = sp_OAMethod @object, 'validateaddress', @x OUTIF @hr <> 0BEGIN EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT PRINT 'Error Occurred Calling Object: ' + @src + ' ' + @desc -- RETURNENDPRINT @xPRINT @aPRINT @f--Destroy the object EXEC @hr = sp_OADestroy @object |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-06-22 : 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 justEXEC @hr = sp_OAMethod @object, 'validateaddress', @x OUT, '2900 FeatherStone Rd', 'auburn hills', 'mi', '93004', 93004or 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 - 2004-06-22 : 15:35:35
|
THAT WAS IT :D, thanks :D |
|
|
|
|
|
|
|