Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Serv 7 - DELETE from records doesn't work...other controls do.(?)

Status
Not open for further replies.

Ovatvvon

Programmer
Feb 1, 2001
1,514
US
Hello all,


Question:

Why would my SQL Server not allow me to delete records from the database, while it will allow me to select, append, and update them?


My Problem:

I'm new to SQL Server. I have been useing Microsoft Access 'till now. I have no problems with select, append, update, and delete in Access. Now with SQL Server 7, it will let me do all of those, except delete. I believe I set the permissions for the Temp. Internet User to be able to delete records, however, I'm not positive I did it right.

This is the error I get on the web page:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ','.


This is the script I used:

sql = "DELETE phone.typeFK, phone.phone, phone.areacode, phone.userFK, phone.phonePK FROM phone WHERE ((phone.userFK)=" & id & ");"
Set conn = Server.CreateObject("ADODB.Connection")
dsn = "users"
conn.Open dsn
Set rs_main = Server.CreateObject("ADODB.Recordset")
rs_main.Open sql, conn, 3, 3




Can anyone give me pointers to get it to work how I want it to?

Thank you in advance!
-Ovatvvon
 
try looking up the syntax for a delete statement.

You cannot delete fields only records

 
I was deleteing only one record where phone.userFK equals the variable "id" which is set by the selection from the page before...
It is only picking out one record
 

Yes, but the syntax lists columns.

The correct syntax is DELETE Table Where <criteria> Terry
------------------------------------
Blessed is the man who, having nothing to say, abstains from giving us worthy evidence of the fact. -George Eliot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top