Avatar billede putte1974 Nybegynder
30. april 2005 - 18:51 Der er 6 kommentarer og
1 løsning

Underlig fejl efter gentagende INSERT INTO

Jeg har en access database liggende lokalt på min egen server og har da heller ingen problemer med at få smidt data ind i databasen via nogle forms på hjemmesiden.

Jeg er dog lidt i vildrede idet jeg har fået en mærkelig fejl som jeg ikke lige kan hitte ud af.

Jeg har dette stykke kode til at indsætte mine værdier i databasen..->

Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=c:\inetpub\wwwroot\hattrick\hattrick.mdb"
strSql = "INSERT INTO playertable (spillernavn, spillerid, age, formen, tsi, kondition, spilfordeling, pasning, winger, forsvar, attack, wage, goaltending) VALUES "
strSql = strSql & "('" & (spillernavn) & "','" & (spillerid) & "','" & (age) & "','" & (formen) & "','" & (tsi) & "','" & (kondition) & "','" & (spilfordeling) & "','" & (pasning) & "','" & (winger) & "','" & (forsvar) & "','" & (attack) & "','" & (wage) & "','" & (goaltending) & "')"

conn.Execute strSql
conn.close   
    set conn = nothing

Problemet er..., at jeg efter en succesfuld opdatering ikke umiddelbart kan opdatere en ny post, hvis jeg gør dette får jeg følgende fejl:

HTTP 500,100 - Intern fejl på serveren - ASP-fejl -
Internet Information Services

--------------------------------------------------------------------------------

Tekniske oplysninger (for supportteknikere)

Fejltype:
Provider (0x80004005)
Uspecificeret fejl
/hattrick/add_player_to_db.asp, line 22


Browsertype:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)

Side:
POST 229 bytes to /hattrick/add_player_to_db.asp

POST Data:
spillernavn=gfdgdf&spillerid=54534&age=17&formen=Udm%E6rket&tsi=54353&wage=54353&kondition=Formidabel&goaltending=Katastrofal&spilfordeling=Katastrofal&pasning=Katastrofal&winger=Katastrofal&forsvar=K .......

Er der en databasehaj der lige kan greje den ?

Det skal hertil siges, at hvis jeg venter ca. 30-60 sekunder med næste opdatering så bliver den opdateret som den første uden problemer.

På forhånd tak
Morten
Avatar billede terry Ekspert
30. april 2005 - 20:20 #1
I dont think this problem has much at all to do with Acces (database). I dont know much at all about ASP but it sounds as though the data isnt getting flushed to the database BEFORE attempting to write a new record, and this will create a conflict if you have an autonumber as the primary key.

You are closing/opening the connection between INSERT's ?
Avatar billede putte1974 Nybegynder
30. april 2005 - 21:25 #2
Hi, thanks for your answer, and i have thought of what you explains... Im using an autonumber as the primary key, and im closing the DB before opening it again for another record.

How do i handle this conflict ? I've learned to close my DB connection when done updating or writing to records.
Avatar billede terry Ekspert
02. maj 2005 - 13:42 #3
I'm not sure how to handle the conflict as this is more relevent to web program which I know very little about. I would guess that its possible to flush the contents of a web page, if you can do that then this may help!
Avatar billede terry Ekspert
03. maj 2005 - 12:47 #4
Its always best to open and close as soon as possible. I was hoping that maybe you were NOT closing so it would y´then be just a case of closing, but that was not the case :o(

Is it possible to flush the contents of a webpage?
Avatar billede terry Ekspert
05. maj 2005 - 17:34 #5
status?
Avatar billede putte1974 Nybegynder
05. maj 2005 - 18:26 #6
Hmm, I still havent found no solution to this problem. But for now it's ok, i'll just keep updating with a short moment of waiting in between the updates :)

Thanks for you help, I'll gladly give you the point i awarded, but how do i do that ? Im kinda new in here :)

Thanks in advance
Morten
Avatar billede terry Ekspert
05. maj 2005 - 18:40 #7
Well I need to place an answer and then it should be streigh forward.

Do you know how to update your WEB pages, this might help!
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Dyk ned i databasernes verden på et af vores praksisnære Access-kurser

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester

IT-JOB

Banedanmark

Systemarkitekt

AL Sydbank A/S (tidligere Arbejdernes Landsbank)

Tech Lead til Datacenter Operations

IT-Universitetet i København

CIO

AL Sydbank A/S (tidligere Arbejdernes Landsbank)

Teamleder til AL Sydbanks GDPR & Tech Regulation i Aabenraa