Behöver hjälp för att komma vidare! Jo jag undrar över den kod jag skickat med här. Det är så att den kommer från ett fritt inloggnings admin system som jag hittat ute på nätet, det jag undrar över är om jag behöver ha något program t ex MySQL installerat för att köra denna koden? För som det är nu fungerar det inte för följande fel dyker upp:
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
Koden för Connection ser ut så här:
Set MyConn=Server.CreateObject("ADODB.Connection")
MyConn.Open "PROVIDER=MSDASQL;" & "DRIVER={Microsoft Access Driver (\*.mdb)}; " & "DBQ=" & MyLoginDB
'-------- Build Fields to be inserted into SQL Statement) -------'
MySQL="Insert into UserData (UserCode, Password"..........osv
jag skulle tippa att de räcker om du klamrar ditt fält Password...
alltså typ:
MySQL="Insert into UserData (UserCode, [Password]"..........osv
men posta gärna hela din sql-sats om de inte funkar
Okidoki här kommer avsnittet! Tack för hjälpen förresten, superbra ställe det här!
Set MyConn=Server.CreateObject("ADODB.Connection")
MyConn.Open "PROVIDER=MSDASQL;" & "DRIVER={Microsoft Access Driver (\*.mdb)}; " & "DBQ=" & MyLoginDB
'-------- Build Fields to be inserted into SQL Statement) -------'
MySQL="Insert into UserData (UserCode, Password"
If Len(Request.Form("Group")) \> 0 Then
MySQL = MySQL & ", Group "
End If
If Len(Request.Form("IndividualAccess")) \> 0 Then
MySQL = MySQL & ", IndividualAccess"
End If
MySQL = MySQL & ", Name"
If Len(Request.Form("NickName")) \> 0 Then
MySQL = MySQL & ", NickName"
End If
If Len(Request.Form("Email")) \> 0 Then
MySQL = MySQL & ", Email"
End If
If Len(Request.Form("ExpirationDate")) \> 0 Then
MySQL = MySQL & ", ExpirationDate)"
Else
MySQL = MySQL & ")"
End If
'-------- Build Data to be inserted into SQL Statement) -------'
MySQL = MySQL & "VALUES ("
MySQL = MySQL & "'" & Request.Form("UserCode") & "'"
MySQL = MySQL & ", '" & Request.Form("Password") & "'"
If Len(Request.Form("Group")) \> 0 Then
MySQL = MySQL & ", '" & Request.Form("Group") & "'"
End If
If Len(Request.Form("IndividualAccess")) \> 0 Then
MySQL = MySQL & ", " & Request.Form("IndividualAccess")
End If
MySQL = MySQL & ", '" & Request.Form("Name") & "'"
If Len(Request.Form("NickName")) \> 0 Then
MySQL = MySQL & ",' " & Request.Form("NickName") & "'"
End If
If Len(Request.Form("Email")) \> 0 Then
MySQL = MySQL & ",' " & Request.Form("Email") & "'"
End If
If Len(Request.Form("ExpirationDate")) \< 1 Then
MySQL = MySQL & ")"
Else
tmpDate = Request.Form("ExpirationDate")
theYear = Year(tmpDate)
theMonth = Month(tmpDate)
theDay = Day(tmpDate)
theDate = theMonth & "/" & theDay & "/" & theYear
MySQL = MySQL & ", '"
MySQL = MySQL & theDate
MySQL = MySQL & "')"
End If
Set MyRs=MyConn.Execute(MySQL)
MyConn.Close
set MyConn=nothing
Redisplay = "Yes"
End If
mellanslag före VALUES, dessutom har du använt minst ett reserverat ord som fältnamn, group. klamra alla dina fältnamn och peta in ett mellanslag så ser det ok ut.