manuel 66
08-12-2012, 15:27
ciao a tutti.
ho bisogno di creare un database .mdb che deve gestire circa 40.000 record:
ID,valore,x,y lo riempo con uno script in asp:
<html>
<script language="javascript" runat="server">
function rand(){
j=Math.round(Math.random()*100);
var tmp;
if (j>=0 && j<=80) tmp=1;
if (j>=81 && j<=84) tmp=2;
if (j>=85 && j<=88) tmp=3;
if (j>=89 && j<=92) tmp=4;
if (j>=93 && j<=96) tmp=5;
if (j>=97 && j<=98) tmp=6;
if (j>=99 && j<=100) tmp=7;
return tmp;
}
</script>
<%
set cn = Server.CreateObject("ADODB.Command")
cn.ActiveConnection = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("database\mappa.mdb")
cn.CommandText = "DELETE * FROM map"
cn.CommandType = 1
cn.CommandTimeout = 0
cn.Prepared = true
cn.Execute()
set cn = nothing
Set cn=Server.CreateObject("ADODB.Connection")
cn.connectionstring = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("database\mappa.mdb")
cn.Open
y=0
for c=1 to 40000
sql="INSERT INTO map (ID,valore,x,y) VALUES ('"& c & "','" & rand() & "','" & int(x) & "','" & int(y) & "')"
cn.execute sql
x=x+1
if (x=200) then
x=0
y=y+1
end if
next
set cn = nothing
response.write "database finito"
%>
</html>
succede che dopo circa 4000 valori (ID) esso salti..
cioe tipo da 4204 a 4632 e con altrettanti salti dopo.. da cosa e dovuto ??
ho gia provato a settare l' ID come chiave primaria e tutte le altre possibili soluzioni, ma nnt.
aiutatemi pls
ho bisogno di creare un database .mdb che deve gestire circa 40.000 record:
ID,valore,x,y lo riempo con uno script in asp:
<html>
<script language="javascript" runat="server">
function rand(){
j=Math.round(Math.random()*100);
var tmp;
if (j>=0 && j<=80) tmp=1;
if (j>=81 && j<=84) tmp=2;
if (j>=85 && j<=88) tmp=3;
if (j>=89 && j<=92) tmp=4;
if (j>=93 && j<=96) tmp=5;
if (j>=97 && j<=98) tmp=6;
if (j>=99 && j<=100) tmp=7;
return tmp;
}
</script>
<%
set cn = Server.CreateObject("ADODB.Command")
cn.ActiveConnection = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("database\mappa.mdb")
cn.CommandText = "DELETE * FROM map"
cn.CommandType = 1
cn.CommandTimeout = 0
cn.Prepared = true
cn.Execute()
set cn = nothing
Set cn=Server.CreateObject("ADODB.Connection")
cn.connectionstring = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("database\mappa.mdb")
cn.Open
y=0
for c=1 to 40000
sql="INSERT INTO map (ID,valore,x,y) VALUES ('"& c & "','" & rand() & "','" & int(x) & "','" & int(y) & "')"
cn.execute sql
x=x+1
if (x=200) then
x=0
y=y+1
end if
next
set cn = nothing
response.write "database finito"
%>
</html>
succede che dopo circa 4000 valori (ID) esso salti..
cioe tipo da 4204 a 4632 e con altrettanti salti dopo.. da cosa e dovuto ??
ho gia provato a settare l' ID come chiave primaria e tutte le altre possibili soluzioni, ma nnt.
aiutatemi pls