|
 |
access_asp thread: Re: Type mismatch Provider error '80020005' - trying to split array of different types
Message #1 by "ANTONIO JONES" <ajjones13@m...> on Wed, 1 May 2002 13:05:50
|
|
It still shows the error...
Reponse.Write(straddproducts)
> How about using Response.Write() to output the values in your array to
the
screen so that you can *see* exactly what you are sending to the database?
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "ANTONIO JONES" <ajjones13@m...>
Subject: [access_asp] Type mismatch Provider error '80020005' - trying to
split array of different types
:
: I am trying to add multiple products or records at one time to an Access
: database. The form uses 4 fields, 3 of which are from a table in an
: access database (prodID, ProdName, Price) and the fourth is just a
: quantity box (intquant). The form passes a hidden field. Getting this
: error
: Provider error '80020005'
: Type mismatch
: which points to --> rsAdd("quantity") = itemInfo(2) <-- below
:
: I think it's bringing all the quatities over, I'm a little stumped HELP!!
:
: ----------------------------------------------------------
: Previous page (Form page)
: <input type="hidden" name="strAddProducts" value="<%= intProdID %>,<%
: strProdName %>, <%Request.form("intquant")%> ">
:
: ----------------------------------------------------------
:
: <!-- #include file="db.asp" -->
: <!-- #include file="adovbs.inc" -->
: <%
:
:
:
: Sub CreateNewOrder()
: Application.lock
: if Application("orderID") = "" then
: Application("orderID") = 1
: end if
:
:
: intOrderID = Application("orderID")
: Session("orderID") = intOrderID
: Conn.Execute("INSERT INTO orders " _
: & " (orderID, status) values " _
: & " ("&intOrderID&", 'OPEN')")
:
: Application("orderID") = Application("orderID") + 1
: Application.Unlock
: End Sub
:
: Sub AddToOrder(nOrderID, nProductID, strPName, nQuant)
: sqlText = "INSERT INTO itemsOrdered " _
: & " (orderID, productID, pName, quantity) values " _
: & "
: ("&nOrderID&", "&nProductID&", '"&strPName&"', "&nQuant&")"
: Conn.Execute(sqlText)
:
: End Sub
:
:
: 'Main program
:
: set Conn = Server.CreateObject("ADODB.Connection")
: Conn.Open ConString
:
: intOrderID = cstr(Session("orderID"))
: if intOrderID = "" then
: CreateNewOrder
: end if
:
: dim rsAdd
: set rsAdd = Server.CreateObject("ADODB.Recordset")
: rsAdd.Open "itemsOrdered", Conn, adOpenStatic, adLockOptimistic,
: adCmdTable
:
: for each item in Request.form("strAddProducts")
:
: strAddProducts = cstr(item)
: itemInfo = split(strAddProducts, ",")
:
:
: rsAdd.addNew
: rsAdd("orderID") = intOrderID
: rsAdd("productID") = itemInfo(0)
: rsAdd("pName") = itemInfo(1)
: rsAdd("quantity") = itemInfo(2)
: rsAdd.Update
:
: AddToOrder intOrderID, intProdID, strName, intQuant
: next
:
:
: Response.Redirect("review.asp")
:
:
: Conn.Close
: set Conn = Nothing
: %>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #2 by "ANTONIO JONES" <ajjones13@m...> on Wed, 1 May 2002 14:17:05
|
|
> Ken,
When I response.write(itemInfo(0)) and response.write(itemInfo(1)) I get
the correct data, but response.write(itemInfo(2)) gives me the type
mismatch error.
I> am trying to add multiple products or records at one time to an Access
d> atabase. The form uses 4 fields, 3 of which are from a table in an
a> ccess database (prodID, ProdName, Price) and the fourth is just a
q> uantity box (intquant). The form passes a hidden field. Getting this
e> rror
P> rovider error '80020005'
T> ype mismatch
w> hich points to --> rsAdd("quantity") = itemInfo(2) <-- below
> I think it's bringing all the quatities over, I'm a little stumped
HELP!!
> ----------------------------------------------------------
P> revious page (Form page)
<> input type="hidden" name="strAddProducts" value="<%= intProdID %>,<%=
s> trProdName %>, <%Request.form("intquant")%> ">
> ----------------------------------------------------------
> <!-- #include file="db.asp" -->
<> !-- #include file="adovbs.inc" -->
<> %
>
> Sub CreateNewOrder()
> Application.lock
> if Application("orderID") = "" then
> Application("orderID") = 1
> end if
>
>
> intOrderID = Application("orderID")
> Session("orderID") = intOrderID
> Conn.Execute("INSERT INTO orders " _
> & " (orderID, status) values " _
> & " ("&intOrderID&", 'OPEN')")
>
> Application("orderID") = Application("orderID") + 1
> Application.Unlock
> End Sub
> Sub AddToOrder(nOrderID, nProductID, strPName, nQuant)
> sqlText = "INSERT INTO itemsOrdered " _
> & " (orderID, productID, pName, quantity) values " _
> & "
(> "&nOrderID&", "&nProductID&", '"&strPName&"', "&nQuant&")"
> Conn.Execute(sqlText)
> End Sub
>
>
> 'Main program
>
> set Conn = Server.CreateObject("ADODB.Connection")
> Conn.Open ConString
> intOrderID = cstr(Session("orderID"))
> if intOrderID = "" then
> CreateNewOrder
> end if
> dim rsAdd
> set rsAdd = Server.CreateObject("ADODB.Recordset")
> rsAdd.Open "itemsOrdered", Conn, adOpenStatic, adLockOptimistic,
a> dCmdTable
> for each item in Request.form("strAddProducts")
> strAddProducts = cstr(item)
> itemInfo = split(strAddProducts, ",")
>
>
> rsAdd.addNew
> rsAdd("orderID") = intOrderID
> rsAdd("productID") = itemInfo(0)
> rsAdd("pName") = itemInfo(1)
> rsAdd("quantity") = itemInfo(2)
> rsAdd.Update
> AddToOrder intOrderID, intProdID, strName, intQuant
> next
>
R> esponse.Redirect("review.asp")
>
> Conn.Close
> set Conn = Nothing
%
Message #3 by "Charles Mabbott" <aa8vs@m...> on Wed, 01 May 2002 09:22:14 -0400
|
|
Maybe this has been done, but;
The fields within the tables that data is being moved between.
Does [in design view] the criteria of the fields within the
tables match [by type] from one data structure to the other?
Regards,
Chuck
>From: "ANTONIO JONES" <ajjones13@m...>
>Reply-To: "Access ASP" <access_asp@p...>
>To: "Access ASP" <access_asp@p...>
>Subject: [access_asp] Re: Type mismatch Provider error '80020005' - trying
>to split array of different types
>Date: Wed, 1 May 2002 14:17:05
>
> > Ken,
>
>When I response.write(itemInfo(0)) and response.write(itemInfo(1)) I get
>the correct data, but response.write(itemInfo(2)) gives me the type
>mismatch error.
>
>
>I> am trying to add multiple products or records at one time to an Access
>d> atabase. The form uses 4 fields, 3 of which are from a table in an
>a> ccess database (prodID, ProdName, Price) and the fourth is just a
>q> uantity box (intquant). The form passes a hidden field. Getting this
>e> rror
>P> rovider error '80020005'
>T> ype mismatch
>w> hich points to --> rsAdd("quantity") = itemInfo(2) <-- below
>
> > I think it's bringing all the quatities over, I'm a little stumped
>HELP!!
>
> > ----------------------------------------------------------
>P> revious page (Form page)
><> input type="hidden" name="strAddProducts" value="<%= intProdID %>,<%
>s> trProdName %>, <%Request.form("intquant")%> ">
>
> > ----------------------------------------------------------
>
> > <!-- #include file="db.asp" -->
><> !-- #include file="adovbs.inc" -->
><> %
>
> >
>
> > Sub CreateNewOrder()
> > Application.lock
> > if Application("orderID") = "" then
> > Application("orderID") = 1
> > end if
> >
> >
> > intOrderID = Application("orderID")
> > Session("orderID") = intOrderID
> > Conn.Execute("INSERT INTO orders " _
> > & " (orderID, status) values " _
> > & " ("&intOrderID&", 'OPEN')")
> >
> > Application("orderID") = Application("orderID") + 1
> > Application.Unlock
> > End Sub
>
> > Sub AddToOrder(nOrderID, nProductID, strPName, nQuant)
> > sqlText = "INSERT INTO itemsOrdered " _
> > & " (orderID, productID, pName, quantity) values " _
> > & "
>(> "&nOrderID&", "&nProductID&", '"&strPName&"', "&nQuant&")"
> > Conn.Execute(sqlText)
>
> > End Sub
> >
> >
> > 'Main program
> >
> > set Conn = Server.CreateObject("ADODB.Connection")
> > Conn.Open ConString
>
> > intOrderID = cstr(Session("orderID"))
> > if intOrderID = "" then
> > CreateNewOrder
> > end if
>
> > dim rsAdd
> > set rsAdd = Server.CreateObject("ADODB.Recordset")
> > rsAdd.Open "itemsOrdered", Conn, adOpenStatic, adLockOptimistic,
>a> dCmdTable
>
> > for each item in Request.form("strAddProducts")
>
> > strAddProducts = cstr(item)
> > itemInfo = split(strAddProducts, ",")
> >
> >
> > rsAdd.addNew
> > rsAdd("orderID") = intOrderID
> > rsAdd("productID") = itemInfo(0)
> > rsAdd("pName") = itemInfo(1)
> > rsAdd("quantity") = itemInfo(2)
> > rsAdd.Update
>
> > AddToOrder intOrderID, intProdID, strName, intQuant
> > next
>
> >
>R> esponse.Redirect("review.asp")
>
> >
> > Conn.Close
> > set Conn = Nothing
>%
"Racial interaction is described by Physics,
for every action there is an opposite
reaction. We hate them, they hate us, and
we hate them back. And there you are, we are
trapped by mathematics."
-Londo B5
http://aa8vs.dhs.org:81/aa8vs
_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail.
http://www.hotmail.com
Message #4 by "ANTONIO JONES" <ajjones13@m...> on Wed, 1 May 2002 15:57:34
|
|
From the form I capture all the objects from the database but I can not
capture the intquant which is the textbox where the quantity will be
entered.
> Maybe this has been done, but;
The fields within the tables that data is being moved between.
Does [in design view] the criteria of the fields within the
tables match [by type] from one data structure to the other?
Regards,
Chuck
>From: "ANTONIO JONES" <ajjones13@m...>
>Reply-To: "Access ASP" <access_asp@p...>
>To: "Access ASP" <access_asp@p...>
>Subject: [access_asp] Re: Type mismatch Provider error '80020005' -
trying
>to split array of different types
>Date: Wed, 1 May 2002 14:17:05
>
> > Ken,
>
>When I response.write(itemInfo(0)) and response.write(itemInfo(1)) I get
>the correct data, but response.write(itemInfo(2)) gives me the type
>mismatch error.
>
>
>I> am trying to add multiple products or records at one time to an Access
>d> atabase. The form uses 4 fields, 3 of which are from a table in an
>a> ccess database (prodID, ProdName, Price) and the fourth is just a
>q> uantity box (intquant). The form passes a hidden field. Getting this
>e> rror
>P> rovider error '80020005'
>T> ype mismatch
>w> hich points to --> rsAdd("quantity") = itemInfo(2) <-- below
>
> > I think it's bringing all the quatities over, I'm a little stumped
>HELP!!
>
> > ----------------------------------------------------------
>P> revious page (Form page)
><> input type="hidden" name="strAddProducts" value="<%= intProdID %>,<%
>s> trProdName %>, <%Request.form("intquant")%> ">
>
> > ----------------------------------------------------------
>
> > <!-- #include file="db.asp" -->
><> !-- #include file="adovbs.inc" -->
><> %
>
> >
>
> > Sub CreateNewOrder()
> > Application.lock
> > if Application("orderID") = "" then
> > Application("orderID") = 1
> > end if
> >
> >
> > intOrderID = Application("orderID")
> > Session("orderID") = intOrderID
> > Conn.Execute("INSERT INTO orders " _
> > & " (orderID, status) values " _
> > & " ("&intOrderID&", 'OPEN')")
> >
> > Application("orderID") = Application("orderID") + 1
> > Application.Unlock
> > End Sub
>
> > Sub AddToOrder(nOrderID, nProductID, strPName, nQuant)
> > sqlText = "INSERT INTO itemsOrdered " _
> > & " (orderID, productID, pName, quantity) values " _
> > & "
>(> "&nOrderID&", "&nProductID&", '"&strPName&"', "&nQuant&")"
> > Conn.Execute(sqlText)
>
> > End Sub
> >
> >
> > 'Main program
> >
> > set Conn = Server.CreateObject("ADODB.Connection")
> > Conn.Open ConString
>
> > intOrderID = cstr(Session("orderID"))
> > if intOrderID = "" then
> > CreateNewOrder
> > end if
>
> > dim rsAdd
> > set rsAdd = Server.CreateObject("ADODB.Recordset")
> > rsAdd.Open "itemsOrdered", Conn, adOpenStatic,
adLockOptimistic,
>a> dCmdTable
>
> > for each item in Request.form("strAddProducts")
>
> > strAddProducts = cstr(item)
> > itemInfo = split(strAddProducts, ",")
> >
> >
> > rsAdd.addNew
> > rsAdd("orderID") = intOrderID
> > rsAdd("productID") = itemInfo(0)
> > rsAdd("pName") = itemInfo(1)
> > rsAdd("quantity") = itemInfo(2)
> > rsAdd.Update
>
> > AddToOrder intOrderID, intProdID, strName, intQuant
> > next
>
> >
>R> esponse.Redirect("review.asp")
>
> >
> > Conn.Close
> > set Conn = Nothing
>%
"Racial interaction is described by Physics,
for every action there is an opposite
reaction. We hate them, they hate us, and
we hate them back. And there you are, we are
trapped by mathematics."
-Londo B5
http://aa8vs.dhs.org:81/aa8vs
_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail.
http://www.hotmail.com
Message #5 by "Ken Schaefer" <ken@a...> on Thu, 2 May 2002 11:22:49 +1000
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "ANTONIO JONES" <ajjones13@m...>
Subject: [access_asp] Re: Type mismatch Provider error '80020005' - trying
to split array of different types
: > Ken,
:
: When I response.write(itemInfo(0)) and response.write(itemInfo(1)) I get
: the correct data, but response.write(itemInfo(2)) gives me the type
: mismatch error.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Can you do the following please:
<%
Response.Write("UBound = " & UBound(itemInfo) & "<br>")
Response.End
%>
If the UBound that is output is actually 2, can you please do the following:
Response.Write(TypeName(ItemInfo(2) & "<br>")
Response.Write
and tell us what is output? If the UBound is less than 2, then you are
trying to access an array element that doesn't exist.
Cheers
Ken
|
|
 |