Active Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 1763
Number of posts: 4498

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Retrieving data from a table Posted by spinster50 on 22 Aug 2004 at 7:18 PM
I was on before trying to retrieve data from a table. My error was "type mismatch in expression". I checked and corrected the errors that I had but was left with this error. I was told that it had to do with the way my field was defined in the table, not as Text but as a Memo, for the size. I changed the data type per Access Help to 'OLE Object' but the query still will not work.

My question:
I want to retrieve the data from a table, put it in a form to be emailed. How can I do this? I have been trying just the old run a query to parse the form fields but it is not working.

Any help would be appreciated.
AB
Report
Re: Retrieving data from a table Posted by Flakes on 22 Aug 2004 at 11:22 PM
: I was on before trying to retrieve data from a table. My error was "type mismatch in expression". I checked and corrected the errors that I had but was left with this error. I was told that it had to do with the way my field was defined in the table, not as Text but as a Memo, for the size. I changed the data type per Access Help to 'OLE Object' but the query still will not work.
:
: My question:
: I want to retrieve the data from a table, put it in a form to be emailed. How can I do this? I have been trying just the old run a query to parse the form fields but it is not working.
:
: Any help would be appreciated.
: AB
:


http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=138

If you still have the error,can we see the query you are using and a bit of the code?
Report
Re: Retrieving data from a table Posted by spinster50 on 23 Aug 2004 at 12:15 PM
: : I was on before trying to retrieve data from a table. My error was "type mismatch in expression". I checked and corrected the errors that I had but was left with this error. I was told that it had to do with the way my field was defined in the table, not as Text but as a Memo, for the size. I changed the data type per Access Help to 'OLE Object' but the query still will not work.
: :
: : My question:
: : I want to retrieve the data from a table, put it in a form to be emailed. How can I do this? I have been trying just the old run a query to parse the form fields but it is not working.
: :
: : Any help would be appreciated.
: : AB
: :
:
:
: http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=138
:
: If you still have the error,can we see the query you are using and a bit of the code?
:
Thanks and I made sure that the Letter was the last in the query, it is also the last in the join also.

Here is a code example - should I read it into a certain kind of field or space?

<%@ Language=VBScript %>
<HTML>
<HEAD>
<%
Dim strConnection
Dim Conn
Dim RSobj
Dim strSql
Dim filePath


filePath = Server.MapPath("information.mdb")
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & filePath
Set RSobj = Conn.Execute("SELECT a.InterestChecked,a.BillNumber,a.BillTitle,Prefix,r.FirstName,r.MiddleName,r.LastName," & _
"Suffix,r.Address,r.City,r.State,r.PostalCode,FullName,Title,Nickname,Organization,c.Address,c.City," & _
"c.State,c.PostalCode,s.Letter FROM Bill_Information a,Registration r,Contact c, Sample_Letters s " & _
"WHERE a.InterestChecked = r.InterestChecked AND r.InterestChecked = c.InterestChecked AND c.InterestChecked = " & _
"s.InterestChecked AND a.InterestChecked = 1")


%>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
</HEAD>
<body ms_positioning="GridLayout">
<TABLE height="559" cellSpacing="0" cellPadding="0" width="488" border="0" ms_2d_layout="TRUE">
<TR vAlign="top">
<TD width="10" height="15"></TD>
<TD width="53"></TD>
<TD width="1"></TD>
<TD width="424"></TD>
</TR>
<TR vAlign="top">
<TD height="17"></TD>
<TD rowSpan="2">
<%
RSobj.Close
Conn.close
%>
</TD>
<TD colSpan="2"></TD>
</TR>
<TR vAlign="top">
<TD height="64"></TD>
<TD colSpan="2">
<DIV ms_positioning="FlowLayout">
<TABLE height="48" cellSpacing="0" cellPadding="0" width="192" border="0" ms_1d_layout="TRUE">
<TR>
<TD>
<%=RSobj("Prefix").Value%>
<%=RSobj("r.FirstName").Value%>
<%=RSobj("r.MiddleName").Value%>
<%=RSobj("r.LastName").Value%>
<%=RSobj("Suffix").Value%>
<%=RSobj("r.Address").Value%>
<%=RSobj("r.City").Value%>
<%=Response.Write(", ")%>
<%=RSobj("r.State").Value%>
<%=RSobj("r.PostalCode").Value%>
</TD>
</TR>
</TABLE>
</DIV>
</TD>
</TR>
<TR vAlign="top">
<TD colSpan="2" height="64"></TD>
<TD colSpan="2">
<DIV ms_positioning="FlowLayout" id="DIV1">
<TABLE height="24" cellSpacing="0" cellPadding="0" width="168" border="0" ms_1d_layout="TRUE">
<TR>
<TD><%=RSobj("FullName").Value%>
<%=RSobj("Title").Value%>
<%=RSobj("Nickname").Value%>
<%=RSobj("Organization").Value%>
<%=RSobj("c.Address").Value%>
<%=RSobj("c.City").Value%>
<%=RSobj("c.State").Value%>
<%=RSobj("c.PostalCode").Value%></TD>
</TR>
</TABLE>
</DIV>
</TD>
</TR>
<TR vAlign="top">
<TD colSpan="2" height="336"></TD>
<TD colSpan="2">
<DIV ms_positioning="FlowLayout" id="DIV2">
<TABLE height="304" cellSpacing="0" cellPadding="0" width="424" border="0" ms_1d_layout="TRUE">
<TR>
<TD><%=RSobj("Letter").Value%></TD>
</TR>
</TABLE>
Report
Re: Retrieving data from a table Posted by Flakes on 23 Aug 2004 at 10:30 PM
: : : I was on before trying to retrieve data from a table. My error was "type mismatch in expression". I checked and corrected the errors that I had but was left with this error. I was told that it had to do with the way my field was defined in the table, not as Text but as a Memo, for the size. I changed the data type per Access Help to 'OLE Object' but the query still will not work.
: : :
: : : My question:
: : : I want to retrieve the data from a table, put it in a form to be emailed. How can I do this? I have been trying just the old run a query to parse the form fields but it is not working.
: : :
: : : Any help would be appreciated.
: : : AB
: : :
: :
: :
: : http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=138
: :
: : If you still have the error,can we see the query you are using and a bit of the code?
: :
: Thanks and I made sure that the Letter was the last in the query, it is also the last in the join also.
:
: Here is a code example - should I read it into a certain kind of field or space?
:
: <%@ Language=VBScript %>
: <HTML>
: <HEAD>
: <%
: Dim strConnection
: Dim Conn
: Dim RSobj
: Dim strSql
: Dim filePath
:
:
: filePath = Server.MapPath("information.mdb")
: Set Conn = Server.CreateObject("ADODB.Connection")
: Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & filePath
: Set RSobj = Conn.Execute("SELECT a.InterestChecked,a.BillNumber,a.BillTitle,Prefix,r.FirstName,r.MiddleName,r.LastName," & _
: "Suffix,r.Address,r.City,r.State,r.PostalCode,FullName,Title,Nickname,Organization,c.Address,c.City," & _
: "c.State,c.PostalCode,s.Letter FROM Bill_Information a,Registration r,Contact c, Sample_Letters s " & _
: "WHERE a.InterestChecked = r.InterestChecked AND r.InterestChecked = c.InterestChecked AND c.InterestChecked = " & _
: "s.InterestChecked AND a.InterestChecked = 1")
:
:
: %>
: <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
: </HEAD>
: <body ms_positioning="GridLayout">
: <TABLE height="559" cellSpacing="0" cellPadding="0" width="488" border="0" ms_2d_layout="TRUE">
: <TR vAlign="top">
: <TD width="10" height="15"></TD>
: <TD width="53"></TD>
: <TD width="1"></TD>
: <TD width="424"></TD>
: </TR>
: <TR vAlign="top">
: <TD height="17"></TD>
: <TD rowSpan="2">
: <%
: RSobj.Close
: Conn.close

: %>
: </TD>
: <TD colSpan="2"></TD>
: </TR>
: <TR vAlign="top">
: <TD height="64"></TD>
: <TD colSpan="2">
: <DIV ms_positioning="FlowLayout">
: <TABLE height="48" cellSpacing="0" cellPadding="0" width="192" border="0" ms_1d_layout="TRUE">
: <TR>
: <TD>
: <%=RSobj("Prefix").Value%>
: <%=RSobj("r.FirstName").Value%>
: <%=RSobj("r.MiddleName").Value%>
: <%=RSobj("r.LastName").Value%>
: <%=RSobj("Suffix").Value%>
: <%=RSobj("r.Address").Value%>
: <%=RSobj("r.City").Value%>
: <%=Response.Write(", ")%>
: <%=RSobj("r.State").Value%>
: <%=RSobj("r.PostalCode").Value%>
: </TD>
: </TR>
: </TABLE>
: </DIV>
: </TD>
: </TR>
: <TR vAlign="top">
: <TD colSpan="2" height="64"></TD>
: <TD colSpan="2">
: <DIV ms_positioning="FlowLayout" id="DIV1">
: <TABLE height="24" cellSpacing="0" cellPadding="0" width="168" border="0" ms_1d_layout="TRUE">
: <TR>
: <TD><%=RSobj("FullName").Value%>
: <%=RSobj("Title").Value%>
: <%=RSobj("Nickname").Value%>
: <%=RSobj("Organization").Value%>
: <%=RSobj("c.Address").Value%>
: <%=RSobj("c.City").Value%>
: <%=RSobj("c.State").Value%>
: <%=RSobj("c.PostalCode").Value%></TD>
: </TR>
: </TABLE>
: </DIV>
: </TD>
: </TR>
: <TR vAlign="top">
: <TD colSpan="2" height="336"></TD>
: <TD colSpan="2">
: <DIV ms_positioning="FlowLayout" id="DIV2">
: <TABLE height="304" cellSpacing="0" cellPadding="0" width="424" border="0" ms_1d_layout="TRUE">
: <TR>
: <TD><%=RSobj("Letter").Value%></TD>
: </TR>
: </TABLE>
:


Why are you closing the recorset there ? remove those lines and lets take it from there.
Report
Re: Retrieving data from a table Posted by spinster50 on 24 Aug 2004 at 7:05 PM
: : : : I was on before trying to retrieve data from a table. My error was "type mismatch in expression". I checked and corrected the errors that I had but was left with this error. I was told that it had to do with the way my field was defined in the table, not as Text but as a Memo, for the size. I changed the data type per Access Help to 'OLE Object' but the query still will not work.
: : : :
: : : : My question:
: : : : I want to retrieve the data from a table, put it in a form to be emailed. How can I do this? I have been trying just the old run a query to parse the form fields but it is not working.
: : : :
: : : : Any help would be appreciated.
: : : : AB
: : : :
: : :
: : :
: : : http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=138
: : :
: : : If you still have the error,can we see the query you are using and a bit of the code?
: : :
: : Thanks and I made sure that the Letter was the last in the query, it is also the last in the join also.
: :
: : Here is a code example - should I read it into a certain kind of field or space?
: :
: : <%@ Language=VBScript %>
: : <HTML>
: : <HEAD>
: : <%
: : Dim strConnection
: : Dim Conn
: : Dim RSobj
: : Dim strSql
: : Dim filePath
: :
: :
: : filePath = Server.MapPath("information.mdb")
: : Set Conn = Server.CreateObject("ADODB.Connection")
: : Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & filePath
: : Set RSobj = Conn.Execute("SELECT a.InterestChecked,a.BillNumber,a.BillTitle,Prefix,r.FirstName,r.MiddleName,r.LastName," & _
: : "Suffix,r.Address,r.City,r.State,r.PostalCode,FullName,Title,Nickname,Organization,c.Address,c.City," & _
: : "c.State,c.PostalCode,s.Letter FROM Bill_Information a,Registration r,Contact c, Sample_Letters s " & _
: : "WHERE a.InterestChecked = r.InterestChecked AND r.InterestChecked = c.InterestChecked AND c.InterestChecked = " & _
: : "s.InterestChecked AND a.InterestChecked = 1")
: :
: :
: : %>
: : <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
: : </HEAD>
: : <body ms_positioning="GridLayout">
: : <TABLE height="559" cellSpacing="0" cellPadding="0" width="488" border="0" ms_2d_layout="TRUE">
: : <TR vAlign="top">
: : <TD width="10" height="15"></TD>
: : <TD width="53"></TD>
: : <TD width="1"></TD>
: : <TD width="424"></TD>
: : </TR>
: : <TR vAlign="top">
: : <TD height="17"></TD>
: : <TD rowSpan="2">
: : <%
: : RSobj.Close
: : Conn.close

: : %>
: : </TD>
: : <TD colSpan="2"></TD>
: : </TR>
: : <TR vAlign="top">
: : <TD height="64"></TD>
: : <TD colSpan="2">
: : <DIV ms_positioning="FlowLayout">
: : <TABLE height="48" cellSpacing="0" cellPadding="0" width="192" border="0" ms_1d_layout="TRUE">
: : <TR>
: : <TD>
: : <%=RSobj("Prefix").Value%>
: : <%=RSobj("r.FirstName").Value%>
: : <%=RSobj("r.MiddleName").Value%>
: : <%=RSobj("r.LastName").Value%>
: : <%=RSobj("Suffix").Value%>
: : <%=RSobj("r.Address").Value%>
: : <%=RSobj("r.City").Value%>
: : <%=Response.Write(", ")%>
: : <%=RSobj("r.State").Value%>
: : <%=RSobj("r.PostalCode").Value%>
: : </TD>
: : </TR>
: : </TABLE>
: : </DIV>
: : </TD>
: : </TR>
: : <TR vAlign="top">
: : <TD colSpan="2" height="64"></TD>
: : <TD colSpan="2">
: : <DIV ms_positioning="FlowLayout" id="DIV1">
: : <TABLE height="24" cellSpacing="0" cellPadding="0" width="168" border="0" ms_1d_layout="TRUE">
: : <TR>
: : <TD><%=RSobj("FullName").Value%>
: : <%=RSobj("Title").Value%>
: : <%=RSobj("Nickname").Value%>
: : <%=RSobj("Organization").Value%>
: : <%=RSobj("c.Address").Value%>
: : <%=RSobj("c.City").Value%>
: : <%=RSobj("c.State").Value%>
: : <%=RSobj("c.PostalCode").Value%></TD>
: : </TR>
: : </TABLE>
: : </DIV>
: : </TD>
: : </TR>
: : <TR vAlign="top">
: : <TD colSpan="2" height="336"></TD>
: : <TD colSpan="2">
: : <DIV ms_positioning="FlowLayout" id="DIV2">
: : <TABLE height="304" cellSpacing="0" cellPadding="0" width="424" border="0" ms_1d_layout="TRUE">
: : <TR>
: : <TD><%=RSobj("Letter").Value%></TD>
: : </TR>
: : </TABLE>
: :
:
:
: Why are you closing the recorset there ? remove those lines and lets take it from there.
:
Sorry, that's me changing things up. Done and same error.
Report
Re: Retrieving data from a table Posted by Flakes on 24 Aug 2004 at 10:06 PM
pls show us the exact error message and thelline where it occurs.
Report
Re: Retrieving data from a table Posted by spinster50 on 25 Aug 2004 at 7:19 PM
: pls show us the exact error message and thelline where it occurs.
:
Error Type:
Microsoft JET Database Engine (0x80004005)
Type mismatch in expression.
/SeniorP/Stage2/advLetter2.asp, line 15

and it occurs here:
Set RSobj = Conn.Execute("SELECT a.InterestChecked,a.BillNumber,a.BillTitle,Prefix,r.FirstName,r.MiddleName,r.LastName," & _
"Suffix,r.Address,r.City,r.State,r.PostalCode,FullName,Title,Nickname,Organization,c.Address,c.City," & _
"c.State,c.PostalCode,s.Letter FROM Bill_Information a,Registration r,Contact c, Sample_Letters s " & _
"WHERE a.InterestChecked = r.InterestChecked AND r.InterestChecked = c.InterestChecked AND c.InterestChecked = " & _
"s.InterestChecked AND a.InterestChecked = 1")

Report
Re: Retrieving data from a table Posted by Flakes on 26 Aug 2004 at 1:16 AM
: : pls show us the exact error message and thelline where it occurs.
: :
: Error Type:
: Microsoft JET Database Engine (0x80004005)
: Type mismatch in expression.
: /SeniorP/Stage2/advLetter2.asp, line 15
:
: and it occurs here:
: Set RSobj = Conn.Execute("SELECT a.InterestChecked,a.BillNumber,a.BillTitle,Prefix,r.FirstName,r.MiddleName,r.LastName," & _
: "Suffix,r.Address,r.City,r.State,r.PostalCode,FullName,Title,Nickname,Organization,c.Address,c.City," & _
: "c.State,c.PostalCode,s.Letter FROM Bill_Information a,Registration r,Contact c, Sample_Letters s " & _
: "WHERE a.InterestChecked = r.InterestChecked AND r.InterestChecked = c.InterestChecked AND c.InterestChecked = " & _
: "s.InterestChecked AND a.InterestChecked = 1")
:
:

What's the datatype of a.InterestChecked?is it a number?If not,pad it with quotes

 Set RSobj = Conn.Execute("SELECT a.InterestChecked,a.BillNumber,a.BillTitle,Prefix,r.FirstName,r.MiddleName,r.LastName," & _
 	"Suffix,r.Address,r.City,r.State,r.PostalCode,FullName,Title,Nickname,Organization,c.Address,c.City," & _
 	"c.State,c.PostalCode,s.Letter FROM Bill_Information a,Registration r,Contact c, Sample_Letters s " & _
 	"WHERE a.InterestChecked = r.InterestChecked AND r.InterestChecked = c.InterestChecked AND c.InterestChecked = " & _
 	"s.InterestChecked AND a.InterestChecked = '1'")



Also,all the interestChecked fields should be of the same datatype.

Other than that,can't see anything wrong with your query.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.