ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 13th, 2003, 10:43 AM
mac-10 mac-10 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 1 mac-10 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Writing to multiple rows

Hi

I am try to insert data from a form in to an access db
When a store is added this asp page writes to two tables in the database
But the product data need to be add to 5 individual row but I get this
Error Identity cannot be determined for newly inserted rows. I think I am writing
The data into the same row every time. What can I do to make sure I a creating a new
row every time I update rsproduct

Hope you can Help

rsproduct.Update

'--------- Conect to storeInfo ---------
Dim rsStore
Dim rsproduct
Dim strSQL
Dim strSQL1
strconn = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("Mydb.mdb")
set conn = server.createobject("adodb.connection")
conn.open strconn
Set rsStore = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT storeName, Dis, catId, storeUrl, unitNumber, Ad, storeLogo, AdTxt, AdImage FROM storeInfo;"
rsStore.CursorType = 2
rsStore.LockType = 3
rsStore.Open strSQL, strconn
rsStore.AddNew
Set rsproduct = Server.CreateObject("ADODB.Recordset")
strSQL1 = "SELECT productName, productDis, productPrice, productImage, storeId FROM storeProducts;"
rsproduct.CursorType = 2
rsproduct.LockType = 3
rsproduct.Open strSQL1, strconn
rsproduct.AddNew
'---------------------------------------

'--------- writing to storeInfo ---------
rsStore.Fields("storeName") = Request.Form("name")
rsStore.Fields("Dis") = Request.Form("dis")
rsStore.Fields("catId") = Request.Form("cat")
rsStore.Fields("storeUrl") = Request.Form("url")
rsStore.Fields("unitNumber") = Request.Form("unit")
rsStore.Fields("Ad") = Request.Form("adver")
rsStore.Fields("storeLogo") = Request.Form("logo")
rsStore.Fields("AdTxt") = Request.Form("adtxt")
rsStore.Fields("AdImage") = Request.Form("adimage")

'---------------------------------------





'--------- writing to product1 ---------
rsproduct.Fields("productName") = Request.Form("productname1")
rsproduct.Fields("productDis") = Request.Form("dis1")
rsproduct.Fields("productImage") = Request.Form("productimage1")
rsproduct.Fields("productPrice") = Request.Form("productprice1")
rsproduct.Fields("storeId") = Request.Form("name")
rsproduct.Update
'---------------------------------------


'--------- writing to product2 ---------
rsproduct.Fields("productName") = Request.Form("productname2")
rsproduct.Fields("productDis") = Request.Form("dis2")
rsproduct.Fields("productImage") = Request.Form("productimage2")
rsproduct.Fields("productPrice") = Request.Form("productprice2")
rsproduct.Fields("storeId") = Request.Form("name")
rsproduct.Update
'---------------------------------------



'--------- writing to product3 ---------
rsproduct.Fields("productName") = Request.Form("productname3")
rsproduct.Fields("productDis") = Request.Form("dis3")
rsproduct.Fields("productImage") = Request.Form("productimage3")
rsproduct.Fields("productPrice") = Request.Form("productprice3")
rsproduct.Fields("storeId") = Request.Form("name")
rsproduct.Update
'---------------------------------------




'--------- writing to product4 ---------
rsproduct.Fields("productName") = Request.Form("productname4")
rsproduct.Fields("productDis") = Request.Form("dis4")
rsproduct.Fields("productImage") = Request.Form("productimage4")
rsproduct.Fields("productPrice") = Request.Form("productprice4")
rsproduct.Fields("storeId") = Request.Form("name")
rsproduct.Update
'---------------------------------------



'--------- writing to product5 ---------
rsproduct.Fields("productName") = Request.Form("productname5")
rsproduct.Fields("productDis") = Request.Form("dis5")
rsproduct.Fields("productImage") = Request.Form("productimage5")
rsproduct.Fields("productPrice") = Request.Form("productprice5")
rsproduct.Fields("storeId") = Request.Form("name")
rsproduct.Update
'---------------------------------------
rsStore.Update

rsStore.Close
rsproduct.Close
Set rsStore = Nothing
Set rsproduct = Nothing
Set strconn = Nothing

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Writing to multiple rows


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT