Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
insertionstr = "SELECT * FROM MYTABLE" commandobject.commandtext=insertionstr commandobject.prepared=true commandobject.parameters.append commandobject.createparameter("gid",3,,1000) commandobject.parameters.append commandobject.createparameter("gcomments",200,,500) commandobject("gid")="1" commandobject("gcomments")="Smith" commandobject.executeAnyone have a better grasp of the command object's syntax than I do? Also, anyone actually have the command object's parameter list? Many hours on technet produce confusion (intentional?) Lastly, How does one pass a hex value to an object using winbatch?
Addtional notes:
commandobject.commandtext=insertionstrworks, and
commandobject.prepared=trueworks if you write commandobject.prepared=1, but of course since we can't get the rest of the lines to work (try as we might to re-write them) we can't tell if 1 is the equivalent of "true" (or is it perhaps -1?). We are trying to store the execution plan at the client temporarily to speed up processing, which is the point of commandobject.prepared.
Also, the connection strings, etc. are all fine, and indeed, if we use plan ol' connection string execution, it works dandy.
We just want to figure out how to pass parameters and take advantage of pre-computed execution plans.
ConnectionObject = adBigint = 20 adParamInput = 1 ParameterObject = CommandObject.CreateParameter("",adBigint,adParamInput) CommandParameters = CommandObject.Parameters AppendMethod = CommandParameters.Append(ParameterObject) ParameterObject.value = 0 ;sets the search value CommandObject.Prepared = 1 CommandObject.ActiveConnection = ConnectionObject CommandObject.CommandText = "SELECT * FROM Table WHERE Column = ?" RSObject = CommandObject.Execute(,ParameterObject,1) IF RSObject.eof() < 0 THEN RETURN "" Data = RSObject.GetString() DataLen = STRLEN(Data) IF STRSUB(Data,DataLen,1) == @CR THEN Data = STRSUB(Data,1,DataLen - 1) RETURN Data ;return the data as a @CR delimited @TAB delimited string with the trailing @CR if any trimmed off ParameterObject.value = 2 ;search value number 2 - usable until the object is destroyed RSObject = CommandObject.Execute(,ParameterObject,1) IF RSObject.eof() < 0 THEN RETURN "" Data = RSObject.GetString() DataLen = STRLEN(Data) IF STRSUB(Data,DataLen,1) == @CR THEN Data = STRSUB(Data,1,DataLen - 1) RETURN DATA ;return the data as a @CR delimited @TAB delimited string with the trailing @CR if any trimmed offExtremely helpful page: http://www.devguru.com/Technologies/ado/quickref/ado_objects_index.html
Article ID: W16076
File Created: 2004:03:30:15:42:44
Last Updated: 2004:03:30:15:42:44