|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
COnverting from Access to SQL
Hi there,
I'm new here and would really like some help. I've recently got the budget for a new server and for SQL server off my boss and I'm building my new web server as we speak. I've set up everything and converted most of my sites from Access 97 to SQL server 2000 up until now I had no problems. The code that's being a pain is here: Set db = server.createobject("ADODB.connection") ' db.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath("admin/sysasslogger.mdb") &"" db.open "Driver={SQL Server};Server=orac;Database=sysasslogger;Uid=sqluser;Pwd=ry234pop98;" Set rs = Server.CreateObject("ADODB.Recordset") SQL = "SELECT * FROM log" rs.open SQL, db, adopenstatic, adlockpessimistic, adcmdtext rs.movelast rs.addnew rs("id") = session("id") rs("Maccount Code") = session("Maccount Code") rs("ip") = session("ip") For some reason it is comming up with an error on the field Maccount Code; the actual error message is: Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'Code'. /logger.asp, line 66 The thing that is baffling me is that in other pages I use field names which have spaces, but I cannot get this working for the life of me. If anyone can help it would be very much appreciated. Cheers, M3ckon |
|
#2
|
|||
|
|||
|
Try surrounding the field name between brackets [ and ] so for example:
rs("Maccount Code") should become rs("[Maccount Code]") But I have a question for you! Why is it that you first make a SELECT Query only to INSERT a new record? Why not simply make an INSERT Query right off the bat? no? Anyway Hope this helps! Sincerely Vlince |
|
#3
|
|||
|
|||
|
Cheers for the reply
the reason it didn't work was due to the locking type .... however I've taken onboard what you've said and I think that may be a better way of doing things M3ckon |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > COnverting from Access to SQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|