Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Empty string

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-04-03, 08:28
Raven Raven is offline
Registered User
 
Join Date: Apr 2003
Posts: 7
Empty string

Hello there,

Can some one tell why the string empty and get this error message?
CompRecID =
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'CompRecID ='.
/asp/info_form_handler.asp, line 18

This is my code:
<%
Dim iRecId
iRecId = Request.Form("CompRecID")

Dim strTo, strQuery
Dim objRS, objConn

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.Mappath("\data\comp.mdb")
objConn.Open

response.write ("CompRecID = " & iRecId)

Set objRS = Server.CreateObject("ADODB.Recordset")
strQuery = "SELECT EmailInformation FROM Company Where CompRecID = " & iRecId

objRS.Open strQuery, objConn

strTo = objRS("EmailInformation")

Set mailer = Server.CreateObject("SoftArtisans.SMTPMail")

mailer.RemoteHost = "mail.company.com"

If Request.form("Email_sender")<>"" Then
mailer.FromAddress = Request.form("Email_sender")
End if

mailer.AddRecipient strTo

mailer.Subject = "Request information"

mailer.BodyText = "First Name: "& request.form("Firstname") & vbcrlf & "Middle Initial: "& request.form("Middleinitial") bla......

If mailer.SendMail then
Response.Write "<P> Mail sent."
Else
Response.Write "<p>Mail failure."
End If

Response.write "<br> " & mailer.response

objRS.Close
Set objRS = Nothing

objConn.Close
Set objConn = Nothing

Set mailer = Nothing
%>
Reply With Quote
  #2 (permalink)  
Old 04-04-03, 11:49
bciarcia bciarcia is offline
Registered User
 
Join Date: Apr 2003
Location: Connecticut
Posts: 17
Re: Empty string

Hey,

Make sure CompRecID is a valid field in your table and also use " ' " around your value since you are searching for and ID

"SELECT EmailInformation FROM Company Where CompRecID = '" & iRecId & "' "


Quote:
Originally posted by Raven
Hello there,

Can some one tell why the string empty and get this error message?
CompRecID =
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'CompRecID ='.
/asp/info_form_handler.asp, line 18

This is my code:
<%
Dim iRecId
iRecId = Request.Form("CompRecID")

Dim strTo, strQuery
Dim objRS, objConn

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.Mappath("\data\comp.mdb")
objConn.Open

response.write ("CompRecID = " & iRecId)

Set objRS = Server.CreateObject("ADODB.Recordset")
strQuery = "SELECT EmailInformation FROM Company Where CompRecID = " & iRecId

objRS.Open strQuery, objConn

strTo = objRS("EmailInformation")

Set mailer = Server.CreateObject("SoftArtisans.SMTPMail")

mailer.RemoteHost = "mail.company.com"

If Request.form("Email_sender")<>"" Then
mailer.FromAddress = Request.form("Email_sender")
End if

mailer.AddRecipient strTo

mailer.Subject = "Request information"

mailer.BodyText = "First Name: "& request.form("Firstname") & vbcrlf & "Middle Initial: "& request.form("Middleinitial") bla......

If mailer.SendMail then
Response.Write "<P> Mail sent."
Else
Response.Write "<p>Mail failure."
End If

Response.write "<br> " & mailer.response

objRS.Close
Set objRS = Nothing

objConn.Close
Set objConn = Nothing

Set mailer = Nothing
%>
Reply With Quote
  #3 (permalink)  
Old 04-04-03, 12:03
Raven Raven is offline
Registered User
 
Join Date: Apr 2003
Posts: 7
I get now this error message

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
/asp/info_form_handler.asp, line 18

and the CompRecID is still empty

CompRecID =
Reply With Quote
  #4 (permalink)  
Old 04-04-03, 12:09
bciarcia bciarcia is offline
Registered User
 
Join Date: Apr 2003
Location: Connecticut
Posts: 17
Post your code with the change made.

Quote:
Originally posted by Raven
I get now this error message

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
/asp/info_form_handler.asp, line 18

and the CompRecID is still empty

CompRecID =
Reply With Quote
  #5 (permalink)  
Old 04-04-03, 16:31
Raven Raven is offline
Registered User
 
Join Date: Apr 2003
Posts: 7
<%
Dim iRecId
iRecId = Request.Form("CompRecID")

Dim strTo, strQuery
Dim objRS, objConn

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.Mappath("\data\comp.mdb")
objConn.Open

response.write ("CompRecID = " & iRecId)

Set objRS = Server.CreateObject("ADODB.Recordset")
strQuery = "SELECT EmailInformation FROM Company Where CompRecID = '" & iRecId & "' "

objRS.Open strQuery, objConn

strTo = objRS("EmailInformation")

Set mailer = Server.CreateObject("SoftArtisans.SMTPMail")

mailer.RemoteHost = "mail.company.com"

If Request.form("Email_sender")<>"" Then
mailer.FromAddress = Request.form("Email_sender")
End if

mailer.AddRecipient strTo

mailer.Subject = "Request information"

mailer.BodyText = "First Name: "& request.form("Firstname") & vbcrlf & "Middle Initial: "& request.form("Middleinitial") bla......

If mailer.SendMail then
Response.Write "<P> Mail sent."
Else
Response.Write "<p>Mail failure."
End If

Response.write "<br> " & mailer.response

objRS.Close
Set objRS = Nothing

objConn.Close
Set objConn = Nothing

Set mailer = Nothing
%>

Quote:
Originally posted by bciarcia
Post your code with the change made.
Reply With Quote
  #6 (permalink)  
Old 04-04-03, 16:47
bciarcia bciarcia is offline
Registered User
 
Join Date: Apr 2003
Location: Connecticut
Posts: 17
That code looks fine..

1. Make sure the field in the form (CompRecID) is spelled correctly.

2. instead of the Response.write ("CompRecID = " & iRecId), use
MSGBOX("CompRecID = " & iRecID) just better debugging practice.

3. What method are you submitting the form (Post,Get)

4. If you are posting, you may want to try using Request.Querystring as the form fields get passed via a querystring. you can also use just plain Request("value").
Reply With Quote
  #7 (permalink)  
Old 04-04-03, 17:17
Raven Raven is offline
Registered User
 
Join Date: Apr 2003
Posts: 7
I tried a few things, for the moment i lost track.
If i tried this first:
strQuery = "SELECT EmailInformation FROM Company"
It's getting the first email address from the database and when i try this:
strQuery = "SELECT EmailInformation FROM Company Where CompRecID = '" & iRecId & "' "
it's giving me errors.
By the way i'm using the post method.


Quote:
Originally posted by bciarcia
That code looks fine..

1. Make sure the field in the form (CompRecID) is spelled correctly.

2. instead of the Response.write ("CompRecID = " & iRecId), use
MSGBOX("CompRecID = " & iRecID) just better debugging practice.

3. What method are you submitting the form (Post,Get)

4. If you are posting, you may want to try using Request.Querystring as the form fields get passed via a querystring. you can also use just plain Request("value").
Reply With Quote
  #8 (permalink)  
Old 04-04-03, 17:25
bciarcia bciarcia is offline
Registered User
 
Join Date: Apr 2003
Location: Connecticut
Posts: 17
what datatype is CompRecID in the database?

also, try saying this;

iRecId = Request.QueryString("CompRecID")


Make sure the form variable you are passing from the form is spelled exactly the same way that you are spelling it on the calling page.

Quote:
Originally posted by Raven
I tried a few things, for the moment i lost track.
If i tried this first:
strQuery = "SELECT EmailInformation FROM Company"
It's getting the first email address from the database and when i try this:
strQuery = "SELECT EmailInformation FROM Company Where CompRecID = '" & iRecId & "' "
it's giving me errors.
By the way i'm using the post method.
Reply With Quote
  #9 (permalink)  
Old 04-04-03, 17:48
Raven Raven is offline
Registered User
 
Join Date: Apr 2003
Posts: 7
CompRecID is autonumbering (long integer)

These are the form input types:
<FORM METHOD="Post" ACTION="../asp/info_form_handler.asp" name="General_Information">
<input type="hidden" name="CompRecID" value="<%=CompRecID%>">
<input type="hidden" name="Firstname" value="<%=Firstname%>">
<input type="hidden" name="Middleinitial" value="<%=Middleinitial%>">
<input type="hidden" name="Lastname" value="<%=Lastname%>">
<input type="hidden" name="Title" value="<%=Title%>">
<input type="hidden" name="Position" value="<%=Position%>">
<input type="hidden" name="Phone1" value="<%=Phone1%>">
<input type="hidden" name="Fax1" value="<%=Fax1%>">
<input type="hidden" name="Email_sender" value="<%=Email_sender%>">
<input type="hidden" name="Question" value="<%=Question%>">
<input type="hidden" name="Institute" value="<%=Institute%>">
<input type="hidden" name="Address" value="<%=Address%>">
<input type="hidden" name="ZIPcode1" value="<%=ZIPcode1%>">
<input type="hidden" name="City" value="<%=City%>">
<input type="hidden" name="State" value="<%=State%>">
<input type="hidden" name="POBox" value="<%=POBox%>">
<input type="hidden" name="ZIPcode2" value="<%=ZIPcode2%>">
<input type="hidden" name="Country" value="<%=Country%>">
<input type="hidden" name="Phone2" value="<%=Phone2%>">
<input type="hidden" name="Fax2" value="<%=Fax2%>">
<input type="hidden" name="Email2" value="<%=Email2%>">
<input type="hidden" name="URL" value="<%=URL%>">
<INPUT TYPE=Submit NAME="Submit" value="Submit this information">
</FORM>

Quote:
Originally posted by bciarcia
what datatype is CompRecID in the database?

also, try saying this;

iRecId = Request.QueryString("CompRecID")


Make sure the form variable you are passing from the form is spelled exactly the same way that you are spelling it on the calling page.
Reply With Quote
  #10 (permalink)  
Old 04-04-03, 18:16
bciarcia bciarcia is offline
Registered User
 
Join Date: Apr 2003
Location: Connecticut
Posts: 17
OK.. this may seem like a strange question, but have you tried making the field a plain text field to verify there is actually a value before you submit the form??


Quote:
Originally posted by Raven
CompRecID is autonumbering (long integer)

These are the form input types:
<FORM METHOD="Post" ACTION="../asp/info_form_handler.asp" name="General_Information">
<input type="hidden" name="CompRecID" value="<%=CompRecID%>">
<input type="hidden" name="Firstname" value="<%=Firstname%>">
<input type="hidden" name="Middleinitial" value="<%=Middleinitial%>">
<input type="hidden" name="Lastname" value="<%=Lastname%>">
<input type="hidden" name="Title" value="<%=Title%>">
<input type="hidden" name="Position" value="<%=Position%>">
<input type="hidden" name="Phone1" value="<%=Phone1%>">
<input type="hidden" name="Fax1" value="<%=Fax1%>">
<input type="hidden" name="Email_sender" value="<%=Email_sender%>">
<input type="hidden" name="Question" value="<%=Question%>">
<input type="hidden" name="Institute" value="<%=Institute%>">
<input type="hidden" name="Address" value="<%=Address%>">
<input type="hidden" name="ZIPcode1" value="<%=ZIPcode1%>">
<input type="hidden" name="City" value="<%=City%>">
<input type="hidden" name="State" value="<%=State%>">
<input type="hidden" name="POBox" value="<%=POBox%>">
<input type="hidden" name="ZIPcode2" value="<%=ZIPcode2%>">
<input type="hidden" name="Country" value="<%=Country%>">
<input type="hidden" name="Phone2" value="<%=Phone2%>">
<input type="hidden" name="Fax2" value="<%=Fax2%>">
<input type="hidden" name="Email2" value="<%=Email2%>">
<input type="hidden" name="URL" value="<%=URL%>">
<INPUT TYPE=Submit NAME="Submit" value="Submit this information">
</FORM>
Reply With Quote
  #11 (permalink)  
Old 04-05-03, 08:50
Raven Raven is offline
Registered User
 
Join Date: Apr 2003
Posts: 7
Yes, did that allso
Reply With Quote
  #12 (permalink)  
Old 04-05-03, 20:10
rhs98 rhs98 is offline
Moderator
 
Join Date: Feb 2002
Location: Hampshire, UK
Posts: 440
try setting iRecID manually; this will allow you to narrow the problem down to this script; or the data being passed in. For example; replacing the line "...iRecID=request....." with
Code:
iRecId = 2
Reply With Quote
  #13 (permalink)  
Old 04-06-03, 18:23
Raven Raven is offline
Registered User
 
Join Date: Apr 2003
Posts: 7
Thank you guys,

The problem is solved.
You all were very helpfull and I appreciate it very much. You put me on the right track to tackle the problem. Thanks again.

Raven

Quote:
Originally posted by rhs98
try setting iRecID manually; this will allow you to narrow the problem down to this script; or the data being passed in. For example; replacing the line "...iRecID=request....." with
Code:
iRecId = 2
Reply With Quote
  #14 (permalink)  
Old 04-06-03, 20:06
rhs98 rhs98 is offline
Moderator
 
Join Date: Feb 2002
Location: Hampshire, UK
Posts: 440
thats what we're here for!

Last edited by rhs98 : 04-09-03 at 10:30.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On