Forums

This topic is locked

Error in Connection string at runtime

Posted 13 Mar 2011 19:47:31
1
has voted
13 Mar 2011 19:47:31 Gary Letchford posted:
Microsoft OLE DB Provider for SQL Server error '80040e14'

Line 1: Incorrect syntax near '1072.'.

/TenantProject/upload1.asp, line 81

Above is the error thrown when attempting to run upload1.asp. This script is suppose to upload an image to a folder and place 4 fields of data into a ms sql server 2000 database. It is written in classic asp. To make it more frustrating, this connection string is used for many other pages and it is working just fine. It is only when I attempted to use my Dreamweaver cs5 server behavior did the problem pop up. Note: It binds just fine, the problem seems to occur at runtime. The reason I am using the server behavior is because I am using an extension for the upload. I have tried everything I can think of, so hopefully some fresh eyes will see something. Thanks!

P.S. The additional files have been transferred to server that are needed for the extension. I'm convinced that the error on line 81 is a result of the initial error on line 1, so ignore that. The extension is developed by dmxzone and I have used it with earlier versions of the extension before although not with cs5 and this version. I was able to successfully upload the file alone. It is when I add the necessity of uploading some fields to the database does the problems occur.

First the code for the connections String:
This file is named stringConn.asp
<%
' FileName="Connection_ado_conn_string.htm"
' Type="ADO"
' DesigntimeType="ADO"
' HTTP="true"
' Catalog=""
' Schema=""
Dim MM_stringConn_STRING
MM_stringConn_STRING = "Provider=SQLOLEDB;Data Source=216.51.232.1;Initial Catalog=SQLDB3985;uid=1072;Pwd=ytedffayh;"
%>

This file is called upload1.asp
<%@LANGUAGE="VBSCRIPT"%>

<%
Dim MM_editAction, aMember
aMember = session("regID"
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME")
If (UploadQueryString <> "" Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(UploadQueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
Else
MM_IIf = ifTrue
End If
End Function
%>
<%
If (CStr(UploadFormRequest("MM_insert") = "form1" Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd

Set MM_editCmd = Server.CreateObject ("ADODB.Command"
MM_editCmd.ActiveConnection = MM_stringConn_STRING
MM_editCmd.CommandText = "INSERT INTO 1072.uploadData (forMember, businessFile, brokerFile, deedFile) VALUES (?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 5, 1, -1, MM_IIF(UploadFormRequest("forMember", UploadFormRequest("forMember", null)) ' adDouble
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 201, 1, -1, UploadFormRequest("businessInfo") ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 201, 1, -1, UploadFormRequest("brokerInfo") ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 201, 1, -1, UploadFormRequest("deedInfo") ' adLongVarChar
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "notYet.asp"
If (UploadQueryString <> "" Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & UploadQueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & UploadQueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
<!--#include file="Connections/stringConn.asp" -->
<!--#include file="ScriptLibrary/incPU3Class.asp" -->
<!--#include file="ScriptLibrary/incPU3Utils.asp" -->
<%
'*** Pure ASP File Upload 3.0.17
' Process form form1
Dim pau, DMX_uploadAction, UploadRequest, UploadQueryString, pau_thePath, pau_nameConflict, pau_saveWidth, pau_saveHeight
Set pau = new PureUpload
pau.ScriptLibrary = "ScriptLibrary"
pau.ConflictHandling = "over"
pau.StoreType = "file"
pau.UploadFolder = """uploadDocs"""
pau.ProcessUpload
pau.SaveAll
%>
<%
Dim objRS
Dim objRS_cmd
Dim objRS_numRows

Set objRS_cmd = Server.CreateObject ("ADODB.Command"
objRS_cmd.ActiveConnection = MM_stringConn_STRING
objRS_cmd.CommandText = "SELECT * FROM 1072.uploadData"
objRS_cmd.Prepared = true

Set objRS = objRS_cmd.Execute
objRS_numRows = 0
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<link href="css/seekTenant.css" rel="stylesheet" type="text/css" media="screen, projection">
<script type="text/javascript"><%=pau.generateScriptCode()%></script>
<script src="ScriptLibrary/incPU3.js" type="text/javascript"></script>
</head>
<body>
<table cellpadding="0" cellspacing="0" border="0" width="600">
<tr>
<td align="center"><br><br><br><br><br><br><br>
<form ACTION="<%=MM_editAction%>" method="post" enctype="multipart/form-data" name="form1" onSubmit="<%=pau.submitCode()%>;return document.MM_returnValue"><br><br>
<input name="forMember" type="hidden" value="<%= aMember %>"
<input name="businessInfo" type="file" onChange="<%=pau.validateCode()%>;return document.MM_returnValue" size="60"><br><br>
<input name="brokerInfo" type="file" onChange="<%=pau.validateCode()%>;return document.MM_returnValue" size="60"><br><br>
<input name="deedInfo" type="file" onChange="<%=pau.validateCode()%>;return document.MM_returnValue" size="60"><br><br>
<input name="" type="submit">
<input type="hidden" name="MM_insert" value="form1">
</form><br><br><br><br><br><br>&nbsp;</td>
</tr>
</table>
</body>
</html>
<%
objRS.Close()
Set objRS = Nothing
%>

Reply to this topic