View Single Post
  #7   Spotlight this post!  
Unread 13-06-2003, 12:17
Raven_Writer's Avatar
Raven_Writer Raven_Writer is offline
2004 Detroit & Pittsburgh Winners
AKA: Eric Hansen
FRC #0005 (RoboCards)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Melvindale
Posts: 1,549
Raven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really nice
Send a message via ICQ to Raven_Writer Send a message via AIM to Raven_Writer Send a message via MSN to Raven_Writer Send a message via Yahoo to Raven_Writer
Quote:
Originally posted by seanwitte
It might be that the connection opened using the Jet provider can't handle a recordset and an update query at the same time. Just use an implicit connection like this:

Code:
Set MyConn = Server.CreateObject("ADODB.Connection")
	Set RS = Server.CreateObject("ADODB.Recordset")
	
	connectString = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"
	MdbFilePath = Server.MapPath("directory\todatabasefile.mdb")
	
	'open the recordset
	SQL_query = "SELECT * FROM files"
	RS.Open SQL_query, connectString
	
	'run the update query
	SQL_query = "UPDATE myTable SET myField = 'foo'"
	MyConn.Open connectString
	MyConn.Execute SQL_Query
If you're running SQL you should ALWAYS use parameterized queries or stored procedures. SQL injection is the easiest way for people to completely screw up your database.
Ok, that works decent...except this error:
Code:
Microsoft OLE DB Provider for ODBC Drivers error '80040e4e' 

Operation was canceled. 

/qtheory/conn.asp, line 9
All the paths are correct, it just deals with this line:
Code:
RS.Open SQL_query, connectString
Also, does anyone know the answer to my first question?
__________________
AIM: wisprmylastbreth
EMail: nightskywriter@gmail.com
Y!: synsoflife

"ai yoru ga" -- "Love the nights"