If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > New approach to "Data type mismatch"

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-12-06, 13:39
QAQueen QAQueen is offline
Registered User
 
Join Date: Nov 2006
Posts: 18
New approach to "Data type mismatch"

I've been trying to correct errors in an ASP page that calls data from an Access database. See the earlier post titled "Data type mismatch...". I was unable to correct the problem, and am trying a different approach (which, obviously, I can get to work either, or I wouldn't be here! )

Here's the picture...our website has a list of projects. When the user double-clicks one of the projects a page pops up displaying data regarding that project. My ASP page worked fine when I had a single Access table...but for a variety of reasons I have split the data up into two. They are linked by the field Project_ID, which is an autonumber field in the main table (ProjectData), and a number field (foreign key) in the secondary table (Comments). A project has one set of data in the ProjectData table, but has multiple Comments (plus a Comment_Date) per project.

So I'm trying to accomplish two things: (a) get the popup page to display the data and the comments as it did when it was all on a single table, and (b) to create the Comment boxes dynamically, i.e. if there is one Comment for the project, then display one box; if there are six Comments for the project, display six boxes.

This is the code I currently have:

</style>
<script type="text/JavaScript" language="JavaScript">
var Comment_String = '<TABLE BORDER="0" ALIGN="center" WIDTH="761" HEIGHT="100" CELLSPACING="0" CELLPADDING="0">';
<%
dim projName
dim Primary_ITC_Resource
dim Secondary_ITC_Resource
dim Project_Contacts
dim Assist_Type
dim Change_Requests
dim Comment_Date
dim Comment

set Conn= Server.CreateObject("ADODB.Connection")
DBConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("ITCDB_Test.mdb")
Conn.Open DBConn

Project_ID = request.querystring("project_nbr")

sql = "select * from AppData where (Project_ID = " & CStr(Project_ID) & ")"
set rst = Conn.Execute(SQL)

if not rst.eof then
Project_ID = rst("Project_ID")
projName = rst("projName")
Primary_ITC_Resource = rst("Primary_ITC_Resource")
Secondary_ITC_Resource = rst("Secondary_ITC_Resource")
Project_Contacts = rst("Project_Contacts")
Assist_Type = rst("Assist_Type")
Change_Requests = rst("Change_Requests")

sql = "select * from Comments where (Project_ID = " & CStr(Project_ID) & ")"
set rst2 = Conn.Execute(SQL)


if not rst2.eof then

do while not rst2.eof
%>


Comment_String +='<TR>';
Comment_String += '<TD WIDTH="1" HEIGHT="50" BGCOLOR="CFDBDE"><pre></pre></TD>';
Comment_String += '<TD class=detaildata WIDTH="50" HEIGHT="50" BGCOLOR="ffffff" ALIGN="left" VALIGN="center">&nbsp;Date:&nbsp;&nbsp</TD>';
Comment_String += '<TD WIDTH="1" HEIGHT="50" BGCOLOR="CFDBDE"><pre></pre></TD>';
Comment_String += '<TD class=returneddata WIDTH="114" HEIGHT="50" BGCOLOR="ffffff" ALIGN="center" VALIGN="center"><%=rst2("Comment_Date")%></TD>';
Comment_String += '<TD WIDTH="1" HEIGHT="50" BGCOLOR="CFDBDE"><pre></pre></TD>';
Comment_String += '<TD WIDTH="5" HEIGHT="50" BGCOLOR="ffffff"><pre></pre></TD>';
Comment_String += '<TD class=returneddata WIDTH="588" HEIGHT="50" BGCOLOR="ffffff" ALIGN="left" VALIGN="center"><%=rst2("Comment")%></TD>';
Comment_String += '<TD WIDTH="1" HEIGHT="50" BGCOLOR="CFDBDE"><pre></pre></TD>';
Comment_String += '</TR>';

<%
rst2.movenext
loop
end if


%>

Comment_String += '</table>';

var object=document.getElementById('commentx');
alert(Comment_String);
object.innerHTML= Comment_String;

<%
end if

Set rst = Nothing
Set rst2 = Nothing
Conn.close
Set Conn= Nothing
%>
</script>
</HEAD>


...and then the BODY, which creates the page, comes after this. When I run this page, the popup opens with the top half (the Project_Data) correctly populated, but then a second, separate popup appears that displays the HTML code, with the correct "Comments" plugged in. So although it's apparently pulling the data correctly, it's not building the second half of hte page where the "Comments" should appear.

Any help would be much appreciated...
Reply With Quote
  #2 (permalink)  
Old 12-14-06, 15:09
QAQueen QAQueen is offline
Registered User
 
Join Date: Nov 2006
Posts: 18
Never mind...

...got it working!
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On