I'm attempting to insert a record to a SQL Server database from an ASP webpage. I'm having trouble determining the best method to use to do this. My MSDN help files seem to be on vacation because they're not giving me what I need today.
Any pointers will be much appreciated!
Thanks, Judy
When I run the code below I get the following error:
Error#: 424 - Object required
TestFile.doc database insert failed.
'open a database connection
'Create a command object
'Create the Insert SQL
'Catch Errors
Any pointers will be much appreciated!
Thanks, Judy
When I run the code below I get the following error:
Error#: 424 - Object required
TestFile.doc database insert failed.
'open a database connection
Code:
strDSN = Application("FileExchange_ConnectionString")
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open strDSN
Code:
Dim cmd
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = conn
cmd.CommandTimeout = 15
cmd.CommandType = adCmdText
Code:
tsql = "INSERT INTO FileCheck (id, Path, Document, UserName, CreateDate) VALUES (NEWID(),'" & Dir & "','" & newfilename0 & "','" & session("User") & "', GETDATE())"
cmd.CommandText = tsql
cmd.Execute
Code:
if Err <> 0 Then
errtext = "Error#: " & err & " - " & err.description
& "<BR>" & newfilename0 & " database insert failed."
End If