ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 6th, 2003, 03:38 AM
m3ckon m3ckon is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Sheffield UK
Posts: 69 m3ckon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 57 sec
Reputation Power: 5
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

Reply With Quote
  #2  
Old November 6th, 2003, 07:19 AM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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

Reply With Quote
  #3  
Old November 6th, 2003, 08:01 AM
m3ckon m3ckon is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Sheffield UK
Posts: 69 m3ckon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 57 sec
Reputation Power: 5
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > COnverting from Access to SQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT