[quoted text, click to view] No one wrote: > I am trying to create a prepared statement in ASP, but am having > problems with creating the parameter object. I do the following > > Set fnParam = peopleUpdate.CreateParameter("@firstname", adVarChar, > adParamInput, 50, peopleSourceRS("firstname")) > > But this gives the following error on the browser: > > Error Type: > ADODB.Command (0x800A0BB9) > Arguments are of the wrong type, are out of acceptable range, or are > in conflict with one another. > > The server doesn't seem to like adVarChar and adParamInput. I did try > to create the parameter without arguments and then assign the > properties, but it gives the same error for .Type and .Direction. What am > I doing incorrectly here? > > thanks
http://www.aspfaq.com/show.asp?id=2112 You may be interested in my command object code generator available here (it's free): http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp&c=&a=clear If your procedure has no output parameters, and you aren't interested in reading the Return parameter, then you don't need an explicit command object. See http://tinyurl.com/jyy0 Bob Barrows -- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
[quoted text, click to view] No one wrote: > Bob Barrows [MVP] wrote: > >> No one wrote: >> >>> I am trying to create a prepared statement in ASP, but am having >>> problems with creating the parameter object. I do the following >>> >>> Set fnParam = peopleUpdate.CreateParameter("@firstname", adVarChar, >>> adParamInput, 50, peopleSourceRS("firstname")) >>> >>> But this gives the following error on the browser: >>> >>> Error Type: >>> ADODB.Command (0x800A0BB9) >>> Arguments are of the wrong type, are out of acceptable range, or are >>> in conflict with one another. >>> >>> The server doesn't seem to like adVarChar and adParamInput. I did >>> try to create the parameter without arguments and then assign the >>> properties, but it gives the same error for .Type and .Direction. >>> What am I doing incorrectly here? >>> >>> thanks >> >> http://www.aspfaq.com/show.asp?id=2112 > > Ugh....how do I know which MDAC I have? I suggest creating a simple asp page with the following two lines of code: <% set cn=createobject("adodb.connection") response.write cn.Version %> Alternatively, you can #include the adovbs.inc file, but as Aaron's article states, that file has many more constants than you will likely need. [quoted text, click to view] > >> >> You may be interested in my command object code generator available >> here (it's free): >> >> http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp&c=&a=clear > > All I see here is how to call a stored procedure. I'm not calling a > stored proc, I want to make a prepared statement. Something like > this: > UPDATE FOO_TABLE SET foName = @name, foPhone = @phone WHERE foId = @id > > And then fill the parameters in at run time. > > If I missed something on the page, please let me know. I thought you were talking about a stored procedure. I think this is what you are asking about: http://groups-beta.google.com/group/microsoft.public.inetserver.asp.db/msg/72e36562fee7804e You don't need to build the parameters collection. Bob Barrows -- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
[quoted text, click to view] No one wrote: > updatedFirstName = peopleSourceRS("firstname") > updatedSurName = peopleSourceRS("surname") > whereId = peopleSourceRS("id") > > Dim params > params = array(updatedFirstName, updatedSurName, whereId) > > and I execute like so: > > peopleUpdate.Execute , array(updatedFirstName, updatedSurName, > whereId), adExecuteNoRecords
You already had an array. Why create a new one? My normal practice is to be explicit about my datatypes. Is whereid numeric? If so, explicitly convert it to the appropriate numeric subtype. Assuming int: params = array(updatedFirstName, updatedSurName, _ clng(whereId)) peopleUpdate.Execute , params, _ adExecuteNoRecords + adCmdText [quoted text, click to view] > > I get this error on the browser: > > Error Type: > Microsoft OLE DB Provider for ODBC Drivers (0x80040E57) > [Microsoft][ODBC SQL Server Driver]String data, right truncation > /RepLocator/ProcessPeopleFile.asp, line 113 >
This is usually a warning. The update should have occurred. You should probably use Left() to make sure the string you send to this statement is not too long for the field into which it is going to be put. You should be using the sqloledb OLE DB provider instead of the ODBC driver: http://www.aspfaq.com/show.asp?id=2126 -- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
I am trying to create a prepared statement in ASP, but am having problems with creating the parameter object. I do the following Set fnParam = peopleUpdate.CreateParameter("@firstname", adVarChar, adParamInput, 50, peopleSourceRS("firstname")) But this gives the following error on the browser: Error Type: ADODB.Command (0x800A0BB9) Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. The server doesn't seem to like adVarChar and adParamInput. I did try to create the parameter without arguments and then assign the properties, but it gives the same error for .Type and .Direction. What am I doing incorrectly here?
[quoted text, click to view] Bob Barrows [MVP] wrote: > No one wrote: > >>I am trying to create a prepared statement in ASP, but am having >>problems with creating the parameter object. I do the following >> >>Set fnParam = peopleUpdate.CreateParameter("@firstname", adVarChar, >>adParamInput, 50, peopleSourceRS("firstname")) >> >>But this gives the following error on the browser: >> >>Error Type: >>ADODB.Command (0x800A0BB9) >>Arguments are of the wrong type, are out of acceptable range, or are >>in conflict with one another. >> >>The server doesn't seem to like adVarChar and adParamInput. I did try >>to create the parameter without arguments and then assign the >>properties, but it gives the same error for .Type and .Direction. What am >>I doing incorrectly here? >> >>thanks > > http://www.aspfaq.com/show.asp?id=2112 Ugh....how do I know which MDAC I have? [quoted text, click to view] > > You may be interested in my command object code generator available here > (it's free): > > http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp&c=&a=clear All I see here is how to call a stored procedure. I'm not calling a stored proc, I want to make a prepared statement. Something like this: UPDATE FOO_TABLE SET foName = @name, foPhone = @phone WHERE foId = @id And then fill the parameters in at run time. If I missed something on the page, please let me know.
[quoted text, click to view] Bob Barrows [MVP] wrote: > No one wrote: > >>Bob Barrows [MVP] wrote: >> >> >>>No one wrote: >>> >>> >>>>I am trying to create a prepared statement in ASP, but am having >>>>problems with creating the parameter object. I do the following >>>> >>>>Set fnParam = peopleUpdate.CreateParameter("@firstname", adVarChar, >>>>adParamInput, 50, peopleSourceRS("firstname")) >>>> >>>>But this gives the following error on the browser: >>>> >>>>Error Type: >>>>ADODB.Command (0x800A0BB9) >>>>Arguments are of the wrong type, are out of acceptable range, or are >>>>in conflict with one another. >>>> >>>>The server doesn't seem to like adVarChar and adParamInput. I did >>>>try to create the parameter without arguments and then assign the >>>>properties, but it gives the same error for .Type and .Direction. >>>>What am I doing incorrectly here? >>>> >>>>thanks >>> >>> http://www.aspfaq.com/show.asp?id=2112 >> >>Ugh....how do I know which MDAC I have? > > > I suggest creating a simple asp page with the following two lines of code: > > <% > set cn=createobject("adodb.connection") > response.write cn.Version > %> > > Alternatively, you can #include the adovbs.inc file, but as Aaron's article > states, that file has many more constants than you will likely need. > > >>>You may be interested in my command object code generator available >>>here (it's free): >>> >>> http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp&c=&a=clear >> >>All I see here is how to call a stored procedure. I'm not calling a >>stored proc, I want to make a prepared statement. Something like >>this: >>UPDATE FOO_TABLE SET foName = @name, foPhone = @phone WHERE foId = @id >> >>And then fill the parameters in at run time. >> >>If I missed something on the page, please let me know. > > > I thought you were talking about a stored procedure. I think this is what > you are asking about: > http://groups-beta.google.com/group/microsoft.public.inetserver.asp.db/msg/72e36562fee7804e > > You don't need to build the parameters collection. > > Bob Barrows I guess ODBC for MS SQL server doesn't support named parameters under
[quoted text, click to view] Bob Barrows [MVP] wrote: > No one wrote: > >>Bob Barrows [MVP] wrote: >> >> >>>No one wrote: >>> >>> >>>>I am trying to create a prepared statement in ASP, but am having >>>>problems with creating the parameter object. I do the following >>>> >>>>Set fnParam = peopleUpdate.CreateParameter("@firstname", adVarChar, >>>>adParamInput, 50, peopleSourceRS("firstname")) >>>> >>>>But this gives the following error on the browser: >>>> >>>>Error Type: >>>>ADODB.Command (0x800A0BB9) >>>>Arguments are of the wrong type, are out of acceptable range, or are >>>>in conflict with one another. >>>> >>>>The server doesn't seem to like adVarChar and adParamInput. I did >>>>try to create the parameter without arguments and then assign the >>>>properties, but it gives the same error for .Type and .Direction. >>>>What am I doing incorrectly here? >>>> >>>>thanks >>> >>> http://www.aspfaq.com/show.asp?id=2112 >> >>Ugh....how do I know which MDAC I have? > > > I suggest creating a simple asp page with the following two lines of code: > > <% > set cn=createobject("adodb.connection") > response.write cn.Version > %> > > Alternatively, you can #include the adovbs.inc file, but as Aaron's article > states, that file has many more constants than you will likely need. > > >>>You may be interested in my command object code generator available >>>here (it's free): >>> >>> http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp&c=&a=clear >> >>All I see here is how to call a stored procedure. I'm not calling a >>stored proc, I want to make a prepared statement. Something like >>this: >>UPDATE FOO_TABLE SET foName = @name, foPhone = @phone WHERE foId = @id >> >>And then fill the parameters in at run time. >> >>If I missed something on the page, please let me know. > > > I thought you were talking about a stored procedure. I think this is what > you are asking about: > http://groups-beta.google.com/group/microsoft.public.inetserver.asp.db/msg/72e36562fee7804e > > You don't need to build the parameters collection. > > Bob Barrows I changed the SQL to use this instead of the named params: peopleUpdateSQL = "UPDATE People SET FirstName = ?, surname = ? WHERE id = ?" I create an array of my values like so: updatedFirstName = peopleSourceRS("firstname") updatedSurName = peopleSourceRS("surname") whereId = peopleSourceRS("id") Dim params params = array(updatedFirstName, updatedSurName, whereId) and I execute like so: peopleUpdate.Execute , array(updatedFirstName, updatedSurName, whereId), adExecuteNoRecords I get this error on the browser: Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80040E57) [Microsoft][ODBC SQL Server Driver]String data, right truncation /RepLocator/ProcessPeopleFile.asp, line 113 ------------------------------------------
[quoted text, click to view] Bob Barrows [MVP] wrote: > No one wrote: > >>Bob Barrows [MVP] wrote: >> >> >>>No one wrote: >>> >>> >>>>I am trying to create a prepared statement in ASP, but am having >>>>problems with creating the parameter object. I do the following >>>> >>>>Set fnParam = peopleUpdate.CreateParameter("@firstname", adVarChar, >>>>adParamInput, 50, peopleSourceRS("firstname")) >>>> >>>>But this gives the following error on the browser: >>>> >>>>Error Type: >>>>ADODB.Command (0x800A0BB9) >>>>Arguments are of the wrong type, are out of acceptable range, or are >>>>in conflict with one another. >>>> >>>>The server doesn't seem to like adVarChar and adParamInput. I did >>>>try to create the parameter without arguments and then assign the >>>>properties, but it gives the same error for .Type and .Direction. >>>>What am I doing incorrectly here? >>>> >>>>thanks >>> >>> http://www.aspfaq.com/show.asp?id=2112 >> >>Ugh....how do I know which MDAC I have? > > > I suggest creating a simple asp page with the following two lines of code: > > <% > set cn=createobject("adodb.connection") > response.write cn.Version > %> > > Alternatively, you can #include the adovbs.inc file, but as Aaron's article > states, that file has many more constants than you will likely need. > > >>>You may be interested in my command object code generator available >>>here (it's free): >>> >>> http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp&c=&a=clear >> >>All I see here is how to call a stored procedure. I'm not calling a >>stored proc, I want to make a prepared statement. Something like >>this: >>UPDATE FOO_TABLE SET foName = @name, foPhone = @phone WHERE foId = @id >> >>And then fill the parameters in at run time. >> >>If I missed something on the page, please let me know. > > > I thought you were talking about a stored procedure. I think this is what > you are asking about: > http://groups-beta.google.com/group/microsoft.public.inetserver.asp.db/msg/72e36562fee7804e > > You don't need to build the parameters collection. > > Bob Barrows I looked at this code, but it seems, for update at least, that the error code trap is backwards. WHen the update happened fine, err contained a
Don't see what you're looking for? Try a search.
|