/ Forside / Teknologi / Udvikling / ASP / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
ASP
#NavnPoint
smorch 9259
Harlekin 1866
molokyle 1040
Steffanst.. 758
gandalf 657
smilly 564
gibson 560
cumano 530
MouseKeep.. 480
10  Random 410
UPDATE problem !!!
Fra : Brian H. Madsen


Dato : 14-07-01 04:27

hey.

Jeg har lige et par problemer med en UPDATE query til en Access 2000
database og haaber der er en eller anden her some kan hjaelpe mig ud.

Der er sikkert mange andre maader at goere dette her paa men der er en
'logisk' grund til at jeg goer det paa denne meget 'langsomme' maade. Det er
en langsom maade at opdaterer en database paa men jeg aendrer SQL senere.

Jeg har proevet to forskellige maader at sende SQL'et paa, men det giver mig
den samme fejl besked.

Okajse, saa proever vi....

<%
strCounter = Request.form("Counter")

DBPath = Server.MapPath( "AccessCheck1.mdb" )
Set Con = Server.CreateObject( "ADODB.Connection" )
Con.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & DBPath

'strCounter = 10
y = 1
x = 0

Do Until x = strCounter
strFirstName = Request.Form("FirstName" & y)
strSurname = Request.Form("Surname" & y)
strUsername = Request.form("Username" & y)
strPassword = Request.form("Password" & y)
strEmailAddress = Request.form("EmailAddress" & y)
strLevel = Request.form("Level" & y)
strID = Request.form("tblID" & y)

'response.write(strFirstName)
'response.write(strID)

strSQLQuery = "Update tblAccount Set FirstName = '" & strFirstName & "'
Where tblID = " & strID & ";"
Con.Execute strSQLQuery, 1
'Set rs = Server.CreateObject("ADODB.Recordset")
' rs.Open strSQLQuery, Con, 3, 3

strSQLQuery = "Update tblAccount Set Surname = '" & strSurname & "' Where
tblID = " & strID & ";"
Con.Execute strSQLQuery, 1
'Set rs = Server.CreateObject("ADODB.Recordset")
' rs.Open strSQLQuery, Con, 3, 3

strSQLQuery = "Update tblAccount Set Username = " & strUsername & "' Where
tblID = " & strID & ";"
Response.write(strSQLQuery)
Con.Execute strSQLQuery, 1
'Set rs = Server.CreateObject("ADODB.Recordset")
' rs.Open strSQLQuery, Con, 3, 3

strSQLQuery = "Update tblAccount Set Password = '" & strPassword & "' Where
tblID = " & strID & ";"
Con.Execute strSQLQuery, 1
'Set rs = Server.CreateObject("ADODB.Recordset")
' rs.Open strSQLQuery, Con, 3, 3

strSQLQuery = "Update tblAccount Set EmailAddress = '" & strEmailAddress &
"' Where tblID = " & strID & ";"
Con.Execute strSQLQuery, 1
'Set rs = Server.CreateObject("ADODB.Recordset")
' rs.Open strSQLQuery, Con, 3, 3

strSQLQuery = "Update tblAccount Set Level1 = '" & strLevel & "' Where tblID
= " & strID & ";"
Con.Execute strSQLQuery, 1
'Set rs = Server.CreateObject("ADODB.Recordset")
' rs.Open strSQLQuery, Con, 3, 3

'strFirstName1 = strFirstName & y
'Response.write(strFirstName)
'Response.write"<BR>"
x = x + 1
y = y + 1
Loop

Con.close
Set Con = Nothing

Response.redirect("account_admin.asp")

%>

Ok, og saa fejl beskeden....

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in
query expression 'tblID ='.

/Mt-Magnet/test/account_insert.asp, line 25


Det er hvad der gaar galt...Saa vidt jeg kan se, saa skulle det virke..

Lidt database info :

tblID = Autonumber/PrimaryKey

Ms Access 2000

.....Jeg haaber der er nogen her som kan finde mit problem....

Paa forhaand tak.

Brian



 
 
Brian H. Madsen (14-07-2001)
Kommentar
Fra : Brian H. Madsen


Dato : 14-07-01 05:10

Ahhh..sorry...Forget it...jeg fandt min 'lille' fejl...



Brian



"Brian H. Madsen" <bmadsen@iinet.com.au> wrote in message
news:3b4fbbe5$0$20734@echo-01.iinet.net.au...
> hey.
>
> Jeg har lige et par problemer med en UPDATE query til en Access 2000
> database og haaber der er en eller anden her some kan hjaelpe mig ud.
>
> Der er sikkert mange andre maader at goere dette her paa men der er en
> 'logisk' grund til at jeg goer det paa denne meget 'langsomme' maade. Det
er
> en langsom maade at opdaterer en database paa men jeg aendrer SQL senere.
>
> Jeg har proevet to forskellige maader at sende SQL'et paa, men det giver
mig
> den samme fejl besked.
>
> Okajse, saa proever vi....
>
> <%
> strCounter = Request.form("Counter")
>
> DBPath = Server.MapPath( "AccessCheck1.mdb" )
> Set Con = Server.CreateObject( "ADODB.Connection" )
> Con.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & DBPath
>
> 'strCounter = 10
> y = 1
> x = 0
>
> Do Until x = strCounter
> strFirstName = Request.Form("FirstName" & y)
> strSurname = Request.Form("Surname" & y)
> strUsername = Request.form("Username" & y)
> strPassword = Request.form("Password" & y)
> strEmailAddress = Request.form("EmailAddress" & y)
> strLevel = Request.form("Level" & y)
> strID = Request.form("tblID" & y)
>
> 'response.write(strFirstName)
> 'response.write(strID)
>
> strSQLQuery = "Update tblAccount Set FirstName = '" & strFirstName & "'
> Where tblID = " & strID & ";"
> Con.Execute strSQLQuery, 1
> 'Set rs = Server.CreateObject("ADODB.Recordset")
> ' rs.Open strSQLQuery, Con, 3, 3
>
> strSQLQuery = "Update tblAccount Set Surname = '" & strSurname & "' Where
> tblID = " & strID & ";"
> Con.Execute strSQLQuery, 1
> 'Set rs = Server.CreateObject("ADODB.Recordset")
> ' rs.Open strSQLQuery, Con, 3, 3
>
> strSQLQuery = "Update tblAccount Set Username = " & strUsername & "' Where
> tblID = " & strID & ";"
> Response.write(strSQLQuery)
> Con.Execute strSQLQuery, 1
> 'Set rs = Server.CreateObject("ADODB.Recordset")
> ' rs.Open strSQLQuery, Con, 3, 3
>
> strSQLQuery = "Update tblAccount Set Password = '" & strPassword & "'
Where
> tblID = " & strID & ";"
> Con.Execute strSQLQuery, 1
> 'Set rs = Server.CreateObject("ADODB.Recordset")
> ' rs.Open strSQLQuery, Con, 3, 3
>
> strSQLQuery = "Update tblAccount Set EmailAddress = '" & strEmailAddress &
> "' Where tblID = " & strID & ";"
> Con.Execute strSQLQuery, 1
> 'Set rs = Server.CreateObject("ADODB.Recordset")
> ' rs.Open strSQLQuery, Con, 3, 3
>
> strSQLQuery = "Update tblAccount Set Level1 = '" & strLevel & "' Where
tblID
> = " & strID & ";"
> Con.Execute strSQLQuery, 1
> 'Set rs = Server.CreateObject("ADODB.Recordset")
> ' rs.Open strSQLQuery, Con, 3, 3
>
> 'strFirstName1 = strFirstName & y
> 'Response.write(strFirstName)
> 'Response.write"<BR>"
> x = x + 1
> y = y + 1
> Loop
>
> Con.close
> Set Con = Nothing
>
> Response.redirect("account_admin.asp")
>
> %>
>
> Ok, og saa fejl beskeden....
>
> Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
>
> [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator)
in
> query expression 'tblID ='.
>
> /Mt-Magnet/test/account_insert.asp, line 25
>
>
> Det er hvad der gaar galt...Saa vidt jeg kan se, saa skulle det virke..
>
> Lidt database info :
>
> tblID = Autonumber/PrimaryKey
>
> Ms Access 2000
>
> ....Jeg haaber der er nogen her som kan finde mit problem....
>
> Paa forhaand tak.
>
> Brian
>
>



Søg
Reklame
Statistik
Spørgsmål : 177554
Tips : 31968
Nyheder : 719565
Indlæg : 6408857
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste