|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Writing to multiple rows |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|