473,783 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Response.Write an Array (OK in Access but Not in MySql)

1 New Member
Hi,

I have been trying to get the following working for days - I wonder if anyone could help me?

I am trying to list a set of database entries as a newspaper column. I am using classic ASP (not NET). It would seem that things fail when the code gets to
Expand|Select|Wrap|Line Numbers
  1. if DataArray(i,j) <> "" then
The following code has been working great when connected to an Access database. I wish to swop the database to MySQL. I have proven that I am connecting OK but it will simply not write out the results when using a MySQL DB.

Any help or clues would be gratefully received!

Thanks.

Expand|Select|Wrap|Line Numbers
  1. <!--#INCLUDE Virtual="adovbs.inc"--><%
  2. dim ColumnArray(), DataArray()
  3. dim intColumns, sql, i, j, k, txtContinue
  4. dim rs, Conn, main
  5.  
  6. intColumns = 4
  7.  
  8. Set Conn = Server.CreateObject("ADODB.Connection")
  9. Conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=204.14.108.61;DATABASE=xxxxxx; USER=xxxxxx;PASSWORD=xxxxxx;OPTION=4;"
  10. Conn.Open
  11. main=request.querystring("IN")
  12. sql = "SELECT DISTINCT towns FROM towns WHERE towns LIKE '" & main & "%' ORDER BY towns ASC"
  13. set rs = server.CreateObject("ADODB.Recordset")
  14. rs.Open sql, Conn, adOpenStatic
  15.  
  16. redim ColumnArray(intColumns-1)
  17. for i = 0 to ubound(ColumnArray)
  18.     ColumnArray(i) = rs.RecordCount * (i+1)/(intColumns)
  19. next
  20.  
  21. if intColumns > 1 then
  22.     redim DataArray(rs.RecordCount/(intColumns-1),intColumns)
  23. else
  24.     redim DataArray(rs.RecordCount,intColumns)
  25. end if
  26.  
  27. for i = 0 to intColumns - 1
  28.     k = 0
  29.     do while j < ColumnArray(i)
  30.         DataArray(k,i) = rs("towns")
  31.     j = j + 1
  32.     k = k + 1
  33.     rs.MoveNext
  34.     loop
  35. next
  36.  
  37. %> 
  38.             <table border="0" width="100%" align="center">
  39.                 <p><%
  40.     for i = 0 to ubound(DataArray)
  41.         Response.Write("<tr>")
  42.         for j = 0 to intColumns - 1
  43.             Response.Write("<td><font size='1' face='Times New Roman'>")
  44.                 if DataArray(i,j) <> "" then
  45.                     'Response.Write(DataArray(i,j))
  46.                     %><a href="instructorsTest.asp?IN=<%Response.Write(DataArray(i,j))%>"><%Response.Write(DataArray(i,j))%></a><%
  47.                 else
  48.                     Response.Write("&nbsp;")
  49.                 end if
  50.             Response.Write("</font>    </td>")
  51.         next
  52.         Response.Write("</tr>")
  53.  
  54.         txtContinue = ""
  55.         for j = 0 to intColumns - 1
  56.             txtContinue = txtContinue & DataArray(i+1,j)
  57.         next
  58.         if txtContinue = "" then Exit For end if
  59.  
  60.     next 
  61.  
  62. rs.Close
  63. set rs = Nothing
  64. conn.Close
  65. set conn = Nothing
  66.  
  67.     %> </p>
  68.             </table>
Jul 15 '07 #1
0 1827

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2642
by: Rob McLennan - ZETLAND | last post by:
Hi, I'm relatively clueless when it comes to correct ASP syntax. I'm testing out a search form for my company's website which is done in ASP. The results are displayed as per the code shown at the very bottom of this message. All I want to do is add a target="top" to the URL which is displayed as a link at the top of the results. I know enough about html to know that it probably goes somewhere into the follwing section: <a href=""" &...
8
2602
by: Jack | last post by:
Hi, Here is my problem: I am logging in to a page, where the page retrieves a record from a database. The text boxes are used in the display formto let the users update the fields, if they desire to. The colorpreference and foodpreference fields are text fields while the FinalUpdate field is a yes/no field in Access Database.
3
1702
by: Farooq Khan | last post by:
why does Response.Write in a method of code-beind class when called from inpage code (i.e in <%---%>), after creating object of that class, fails when called while it works perfectly ok while calling the same method same way except for creating object instead directly calling the method? i get this when trying to do that:- ************************************************** Response is not available in this context. Description: An...
11
26886
by: Russ | last post by:
My web app writes some binary data to a file at the client site via Response.Write and Response.BinaryWrite. This action is accomplished in response to a button click, with C# code behind as follows: private void SubmitButton_Click (object sender, System.EventArgs e) { // Set up the response to write the print file to the client Response.Clear (); Response.AppendHeader ("Content-Disposition", "filename=WebPrint.prn");
3
6443
by: Dave Keen | last post by:
Hi all. Hope you can help me. This should be easy but I can't make this work. In brief I am building a page of thumbnails using images held in a SQLServer 2000 database. I do this by creating imagebuttons which point to a dummy page that takes the image and displays it via response. All works fine if I use explicit paths to a file (response.writefile(<filename>) or directly pass through the database image...
4
4327
by: cbtechlists | last post by:
I have an ASP app that we've moved from a Windows 2000 to a Windows 2003 server (sql server 2000 to sql server 2005). The job runs fine on the old servers. Part of the app takes a recordset and response.writes out comma delimited strings so that the results are opened in Excel or saved to a flat file. Basically, it looks something like this like this:
5
2293
by: JoeW | last post by:
Hi, I'm trying to create an ASP page which gets its content from a txt file. eg. I have a txt file which contains this: <html> <head> <title>PageTitle</title> </head> <body> Page Content
4
5669
by: | last post by:
Hi all, I want to create a method that does the following: 1) Programmatically instantiate a new XmlDataSource control 2) For each file in a named directory, make a "FileSystemItem" element 3) On each FileSystemItem Element, make two child nodes, one with the file name, one with the file size. ie. <filesystemitems> <filesystemitem>
3
3315
by: =?Utf-8?B?SmFzb24gSGFydHNvZQ==?= | last post by:
I get the error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write...when i postback to the page. The problem is, i need to write some dynamic javascript on postback and make sure it's rendered to the page. I'm setting up Omniture analytics for my site, <script language="JavaScript"...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10083
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.