Page 1 of 1

PostPosted: Wed May 07, 2003 9:48 am
by Mikael
I'm trying to use the following code to stop names(chosen by a random number)being written more than once to a Db:

AlChosenOne(){

dbopen("Nums");
ran2=dbread('i');
while(dbpos()!=1){
dbread('i');
}

if(!ran2){

nameCounter++;
dbwrite(ran2);
dbclose();
dbopen("Names");
dbwrite(nameOne);
dbclose();
CheckCounter();
}
}

but it doesn't do what it's supposed to. I've also tried:

AlChosenOne(){

dbopen("Nums");
dbread('i');
if(!'i'){
dbwrite(ran2);
}else{
ran2=dbread('i');
while(dbpos()!=1){
dbread('i');
}

if(!ran2){

nameCounter++;
dbwrite(ran2);
dbclose();
dbopen("Names");
dbwrite(nameOne);
dbclose();
CheckCounter();
}
}
}
along with hundreds of other possibilities; all without success. Does anyone have any suggestions?

Thanks in advance,

Mikael