Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Received Error While batch update


Message #1 by "jagjot singh" <jagjot@h...> on Sat, 24 Mar 2001 19:31:02
jojoHello EveryBody

 I need your help please help me out this problem



i am working on windows 98 /pws

i am trying to update all the fields of my database(table) named BHREX .

i am using updatebatch method to update .

I AM ALSO USING COPY OF ADOVBS.INC FILE AS .ASP

when i tried to update it says :



Request object error 'ASP 0105 : 80004005' 



Index out of range 



/works/tele1/test/circle/ssa/insert.asp, line 25 



An array index is out of range. 



when i used 'on error resume next' then it worked 

but only when i am using 2 / 3 no of columns to update 



same way i tried to updatebatch for all the fields then it updates my 

database

but,,,,,, when i refresh my page to check the updated values it shows 

previous values,,

Kindly help please please ..

I need you peoples help..

I am attaching my code ,

page ara_ssa.asp is the field page by which i extract values from database 

table

page insert.asp inserts using updatebatch  method kindly help sir



This is my page htm



<% 

   Option Explicit

   Dim strco

%>

<!--#include file="connect.asp"-->

<html>

<head>

<title>ARA SSA PAGE</title>

</head>

<%

Dim Conn

Dim RSUser

Dim SQL

Set Conn=Server.CreateObject("ADODB.Connection")

Set RSUser = Server.CreateObject("ADODB.Recordset")

Conn.Open strco

SQL = "Select * from BHREX WHERE SSA='PATNA'"

RSUser.Open SQL,Conn,1,2

%>

<p> </p>

<center><font face='verdana' color='#204C79' size='3'><b><font 

color=red>ARA</font> SSA INFORMATION</b></font></center>

<%

Dim txtcount

txtcount = 1

Response.write"<form action='insert.asp' method=post>"

Response.write "<br><center><table border=0>"

Response.write "<tr><td width='129' height='30' bgcolor='#204C79' 

align='center'><font face='verdana' size='2' 

color='#FFFFFF'><center><b>NAME OF EXCHANGE</font></td><td width='129' 

height='30' bgcolor='#204C79' align='center'><font face='verdana' size='2' 

color='#FFFFFF'><center><b>BUILDING HIRED / DEPTS</font></td><td 

width='129' height='30' bgcolor='#204C79' align='center'><font 

face='verdana' size='2' color='#FFFFFF'><center><b>STATION</td><td 

width='129' height='30' bgcolor='#204C79' align='center'><font 

face='verdana' size='2' color='#FFFFFF'><center><b>DISTRICT</td><td 

width='129' height='30' bgcolor='#204C79' align='center'><font 

face='verdana' size='2' color='#FFFFFF'><center><b>SSA</d></font></td><td 

width='129' height='30' bgcolor='#204C79' align='center'><font 

face='verdana' size='2' color='#FFFFFF'><center><b>AREA</td><td 

width='129' height='30' bgcolor='#204C79' align='center'><font 

face='verdana' size='2' color='#FFFFFF'><center><b>TERIFF</td><td 

width='129' height='30' bgcolor='#204C79' align='center'><font 

face='verdana' size='2' color='#FFFFFF'><center><b>TECHTYPE</td><td 

width='129' height='30' bgcolor='#204C79' align='center'><font 

face='verdana' size='2' color='#FFFFFF'><center><b>EQUIPCAP</td><td 

width='129' height='30' bgcolor='#204C79' align='center'><font 

face='verdana' size='2' color='#FFFFFF'><center><b>DELS</td><td 

width='129' height='30' bgcolor='#204C79' align='center'><font 

face='verdana' size='2' color='#FFFFFF'><center><b>WAITLIST</td><td 

width='129' height='30' bgcolor='#204C79' align='center'><font 

face='verdana' size='2' color='#FFFFFF'><center><b>SDCA</td><td 

width='129' height='30' bgcolor='#204C79' align='center'><font 

face='verdana' size='2' color='#FFFFFF'><center><b>TYPE</td><td 

width='129' height='30' bgcolor='#204C79' align='center'><font 

face='verdana' size='2' color='#FFFFFF'><center><b>MEDIA</td><td 

width='129' height='30' bgcolor='#204C79' align='center'><font 

face='verdana' size='2' color='#FFFFFF'><center><b>FIELD16</td><td 

width='129' height='30' bgcolor='#204C79' align='center'><font 

face='verdana' size='2' color='#FFFFFF'><center><b>FIELD17</td><td 

width='129' height='30' bgcolor='#204C79' align='center'><font 

face='verdana' size='2' color='#FFFFFF'><center><b>FIELD18</td><td 

width='129' height='30' bgcolor='#204C79' align='center'><font 

face='verdana' size='2' color='#FFFFFF'><center><b>FIELD19</td><td 

width='129' height='30' bgcolor='#204C79' align='center'><font 

face='verdana' size='2' color='#FFFFFF'><center><b>CAPACITY</td><td 

width='129' height='30' bgcolor='#204C79' align='center'><font 

face='verdana' size='2' color='#FFFFFF'><center><b>FIELD21</td></tr>"

WHILE NOT RSUser.EOF

	Response.write "<tr><td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center><input size=9 type=text 

name="& txtcount &" value="& RSUser("EXCHNAME") &"></font></td>"

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center>?</td>"

	txtcount = txtcount + 1

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center><input size=9 type=text 

name="& txtcount &" value="& RSUser("STATION") &"></td>"

	txtcount = txtcount + 1

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center><input size=9 type=text 

name="& txtcount &" value="& RSUser("DISTRICT") &"></td>"

	txtcount = txtcount + 1

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center>"& RSUser("SSA") &"</td>"

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center><input size=9 type=text 

name="& txtcount &" value="& RSUser("AREA") &"></td>"

	txtcount = txtcount + 1

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center><input size=9 type=text 

name="& txtcount &" value="& RSUser("TERIFF") &"></td>"

	txtcount = txtcount + 1

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center><input size=9 type=text 

name="& txtcount &" value="& RSUser("TECHTYPE") &"></td>"

	txtcount = txtcount + 1

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center><input size=9 type=text 

name="& txtcount &" value="& RSUser("EQUIPCAP") &"></td>"

	txtcount = txtcount + 1

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center><input size=9 type=text 

name="& txtcount &" value="& RSUser("DELS") &"></td>"

	txtcount = txtcount + 1

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center><input size=9 type=text 

name="& txtcount &" value="& RSUser("WAITLIST") &"></td>"

	txtcount = txtcount + 1

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center><input size=9 type=text 

name="& txtcount &" value="& RSUser("SDCA") &"></td>"

	txtcount = txtcount + 1

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center><input size=9 type=text 

name="& txtcount &" value="& RSUser("TYPE") &"></td>"

	txtcount = txtcount + 1

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center><input size=9 type=text 

name="& txtcount &" value="& RSUser("MEDIA") &"></td>"

	txtcount = txtcount + 1

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center>-</td>"

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center>-</td>"

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center>-</td>"

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center>-</td>"

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center><input size=9 type=text 

name="& txtcount &" value="& RSUser("CAPACITY") &"></td>"

	txtcount = txtcount + 1

	Response.write "<td bgcolor='#7CA5CE' align='center'><font 

face='verdana' size='2' color='BLACK'><center>-</td></tr>"

	txtcount = txtcount + 1

	RSUser.MoveNext

Wend

Response.write "</table>"

Response.write "<input type=submit value='CLICK TO UPDATE'>"

Response.write "</form>"

Conn.close

Set Conn = Nothing

%>

</body>

</html>





This is insert page************************************************



<% 

	Option Explicit

	Dim strco

	Dim Conn

	Dim RSUser

	Dim SQL

	Dim txtcount

%>

<!--#include file="connect.asp"-->

<!--#include file="adovbs.asp"-->

<html>

<head>

<title>Insert Data</title>

</head>

<%

Set Conn = Server.CreateObject("ADODB.Connection")

Set RSUser = Server.CreateObject("ADODB.Recordset")

Conn.open strco

SQL="Select * from BHREX WHERE SSA='PATNA'"

RSUser.Open SQL ,Conn ,adOpenStatic ,adLockBatchOptimistic ',adCmdTable

%>



<p> </p>

<%

txtcount = 1

On Error Resume Next

WHILE NOT RSUser.EOF

		RSUser("EXCHNAME").value=Request.Form(txtcount)

		txtcount = txtcount + 1

		RSUser("STATION").value=Request.Form(txtcount) 

		txtcount = txtcount + 1

		RSUser("DISTRICT").value =Request.Form(txtcount) 

		txtcount = txtcount + 1

		RSUser("AREA").value=Request.Form(txtcount) 

		txtcount = txtcount + 1

		RSUser("TERIFF").value=Request.Form(txtcount) 

		txtcount = txtcount + 1

		RSUser("TECHTYPE").value=Request.Form(txtcount) 

		txtcount = txtcount + 1

		RSUser("EQUIPCAP").value=Request.Form(txtcount) 

		txtcount = txtcount + 1

		RSUser("DELS").value=Request.Form(txtcount) 

		txtcount = txtcount + 1

		RSUser("WAITLIST").value=Request.Form(txtcount) 

		txtcount = txtcount + 1

		RSUser("SDCA").value=Request.Form(txtcount) 

		txtcount = txtcount + 1

		RSUser("TYPE").value=Request.Form(txtcount) 

		txtcount = txtcount + 1

		RSUser("MEDIA").value=Request.Form(txtcount) 

		txtcount = txtcount + 1

		RSUser("CAPACITY").value=Request.Form(txtcount) 

		txtcount = txtcount + 1

		RSUser.MoveNext

		RSUser.UpdateBatch adAffectAll

WEND

RSUser.close

Set RSUser=Nothing

%>

<p align="center"><font color=Red face=verdana size=5>THANK"S<br>Values 

Inserted</font><br>

<a href="">Click Here to go back</a></p>

</body>

</html>

 kindly help




  Return to Index