473,405 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

ASP and MySql - Connection Error

nathj
938 Expert 512MB
Hi,

I'm new to ASP, I normally develop in PHP but this little project requires me to use ASP. Being a newbie in this I've run into some difficulty.

I'm modifying code from a third party. Basicaly there is a site which I am replacing next year with a new branded version and this new site is powered bya DB. However, the existing site needs to be kept up to date as well. So rather than hard code HTMl for the event listing on the existing site as well as update the DB on the new site I thought I would use the DB to generate the event listing on the existing site.

Right, thats the background, here's the problem.

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1044: Cannot use more than one type in a for, using, fixed, or declaration statement
So the code looks like:
Expand|Select|Wrap|Line Numbers
  1. <%@ Page language="c#" Codebehind="events.aspx.cs" AutoEventWireup="false" Inherits="ChristianLeadersForum.events" %>
  2. <%@Register TagPrefix="Controls" TagName="Navigation" Src="Controls/Navigation.ascx" %>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  4.     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  5. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  6. <head>
  7.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  8.     <title>Christian Leaders' Forum - Information</title>
  9.     <link rel="stylesheet" type="text/css" href="_common/css/screen.css" />
  10. <!--[if IE 6]>
  11.     <link rel="stylesheet" type="text/css" href="_common/css/ie6    .css" />
  12. <![endif]-->
  13. </head>
  14. <body>
  15. <div id="masthead">
  16.     <div id="container">
  17.     <h1><img src="_common/img/logo-clf.png" alt="Christian Leaders' Forum" /></h1>
  18.     <Controls:Navigation id="Navigation" Runat="server"></Controls:Navigation>
  19.     </div>
  20. </div>
  21. <div id="wrap">
  22.     <div id="wrap-content" class="cf"> 
  23.     <% 
  24.         Dim sConnection, objConn , objRS 
  25.  
  26.         sConnection = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=ip:servername; DATABASE=myDB; UID=user;PASSWORD=password; OPTION=3" 
  27.  
  28.         Set objConn = Server.CreateObject("ADODB.Connection") 
  29.  
  30.         objConn.Open(sConnection) 
  31.  
  32.         Set objRS = objConn.Execute("SELECT a.ID, a.venueID, a.speakerID, a.thumbnail, a.title, a.summary, a.details, a.isFood, a.canBook, concat(date_format(a.startDate,'%D-'), date_format(a.endDate, '%D %b %Y')) as date1, date_format(a.startDate, '%D %b %Y') as date2, a.startDate, a.endDate, a.startTime, a.endTime, b.URL, b.name, b.line1, b.line2, b.postcode, c.name as speaker, c.biog, c.image FROM tbl_event a LEFT OUTER JOIN tbl_venue b on b.ID = a.venueID LEFT OUTER JOIN tbl_speaker c on c.ID = a.speakerID")
  33.  
  34.         While Not objRS.EOF
  35.         Response.Write & "<h3>" & objRS.Fields("title") & "</h3>"
  36.         Response.Write & "<p></p><h3>Date: </h3>"     
  37.         If objRS.Fields("endDate") > objRS.Fields("startDate") Then
  38.             Response.Write & objRS.Fields("date1")
  39.         Else
  40.             Response.Write & objRS.Fields("date2")
  41.         End If
  42.         Response.Write & "<h3>Venue: </h3>"      
  43.         Response.Write & "<p><a target='_blank' title='google map of venue' href='" & onjRS.Fields["URL"] & "'>" & objRS.Fields["name"] & "</a><br />"
  44.         Response.Write & objRS.Fields["line1"] & "<br />" & objRS.Fields["line2"] & "<br />" & objRS.Fields["postcode"] & "</p>" & 
  45.         Response.Write & "<h3>Extra Information: </h3>" & onjRS.Fields["details"]
  46.         objRS.MoveNext
  47.         Wend 
  48.  
  49.         objRS.Close
  50.         Set objRS = Nothing
  51.         objConn.Close
  52.         Set objConn = Nothing  
  53.     %>
  54.     </div>
  55.     <p id="footer">&copy; Christian Leaders' Forum 2007. <a href="http://www.mandogroup.com/">Web Design by Mando Group.</a></p>
  56. </div>
  57. </body>
  58. </html>
  59.  
If someone can point me in the right direction and help me out with this that would be great.

Many thanks
nathj
Sep 8 '08 #1
7 3837
JamieHowarth0
533 Expert 512MB
Hi nathj,

Firstly, are you using classic ASP or ASP.NET? There is a distinct difference between the two.
Your inline code suggests you are using classic ASP but the declarations before the <!DOCTYPE> tag are for ASP.NET only, hence why there is immediate confusion.

Let us know what language you are writing in (classic ASP or ASP.NET) and we can guide you further. If you can't tell us that, then we can translate the code into one or the other for you in very little time.

Best regards,

medicineworker
Sep 8 '08 #2
nathj
938 Expert 512MB
Hi nathj,

Firstly, are you using classic ASP or ASP.NET? There is a distinct difference between the two.
Your inline code suggests you are using classic ASP but the declarations before the <!DOCTYPE> tag are for ASP.NET only, hence why there is immediate confusion.

Let us know what language you are writing in (classic ASP or ASP.NET) and we can guide you further. If you can't tell us that, then we can translate the code into one or the other for you in very little time.

Best regards,

medicineworker
Hi medicineworker,

I must be honest I have no idea. I didn't write this site myself, I am just maintaining it for 6 months. I thought it was classic asp but if the <DOCTYPE> indicates othrewsie then perhaps it's asp.Net.

I don't have .Net installed (I have the discs though). I guess I'll have to bow to your superior knowledge as on this one I don't have a clue.

Cheers
nathj
Sep 8 '08 #3
JamieHowarth0
533 Expert 512MB
Hi nathj,

This is what causes confusion:
Expand|Select|Wrap|Line Numbers
  1. <%@ Page language="c#" Codebehind="events.aspx.cs" AutoEventWireup="false" Inherits="ChristianLeadersForum.events" %>
  2. <%@Register TagPrefix="Controls" TagName="Navigation" Src="Controls/Navigation.ascx" %>
  3.  
That is ASP.NET declaration code - it tells the web server that the page being processed is an ASP.NET page and therefore the ASP.NET engine should handle the processing of it.

However the code between <% and %> in the document body is classic ASP.

Do you need the in-built navigation control that the page is trying to include (<Controls:Navigtation runat="server"></Controls:Navigtation>)?

Best regards,

medicineworker
Sep 8 '08 #4
nathj
938 Expert 512MB
Hi nathj,

This is what causes confusion:
Expand|Select|Wrap|Line Numbers
  1. <%@ Page language="c#" Codebehind="events.aspx.cs" AutoEventWireup="false" Inherits="ChristianLeadersForum.events" %>
  2. <%@Register TagPrefix="Controls" TagName="Navigation" Src="Controls/Navigation.ascx" %>
  3.  
That is ASP.NET declaration code - it tells the web server that the page being processed is an ASP.NET page and therefore the ASP.NET engine should handle the processing of it.

However the code between <% and %> in the document body is classic ASP.

Do you need the in-built navigation control that the page is trying to include (<Controls:Navigtation runat="server"></Controls:Navigtation>)?

Best regards,

medicineworker
Hi medicineworker,

Thanks fro the swift reply.

I do need that code - as this is the main navigation of the page. The alternative I guess is to simply duplicate that navigation code, unless you can convert the code I have written (classic ASP) into ASP.net?

Many thanks
nathj
Sep 8 '08 #5
JamieHowarth0
533 Expert 512MB
Hi nathj,

Converting ASP.NET to ASP (the main navigation) will be more time-consuming that converting the classic ASP code to .NET.

I will review your code on my lunch break and see what I can come up with.

Best regards,

medicineworker

P.S. ASP.NET runtimes (the binaries needed to compile and interpret .NET code) come as redistributables from Microsoft's website (and pre-packaged with Windows XP SP3 onwards), and the classic ASP runtimes are already included on all Windows OS's since NT4. If you would consider getting into .NET (you mentioned you're a predominantly PHP programmer) then I recommend going to Microsoft's website and downloading Visual Web Developer Express Edition and Microsoft SQL Server Express Edition - both are free to download and use for personal usage (or MySQL Community Edition and the .NET connector), it'll give you a good start to kick off ASP.NET web development. I also recommend a number of good reference books by O'Reilly or Sams Publishing.
Sep 8 '08 #6
nathj
938 Expert 512MB
Hi nathj,

Converting ASP.NET to ASP (the main navigation) will be more time-consuming that converting the classic ASP code to .NET.

I will review your code on my lunch break and see what I can come up with.

Best regards,

medicineworker

P.S. ASP.NET runtimes (the binaries needed to compile and interpret .NET code) come as redistributables from Microsoft's website (and pre-packaged with Windows XP SP3 onwards), and the classic ASP runtimes are already included on all Windows OS's since NT4. If you would consider getting into .NET (you mentioned you're a predominantly PHP programmer) then I recommend going to Microsoft's website and downloading Visual Web Developer Express Edition and Microsoft SQL Server Express Edition - both are free to download and use for personal usage (or MySQL Community Edition and the .NET connector), it'll give you a good start to kick off ASP.NET web development. I also recommend a number of good reference books by O'Reilly or Sams Publishing.
Hi medicineworker,

Thanks for the help and for the advice. I really appreciate you taking the time to help me out.

Many thanks
nathj
Sep 8 '08 #7
nathj
938 Expert 512MB
I got to thinking about the ASP.Net and classic ASP issue and decided I would remove the .net stuff, duplicate the navigation and see what happens.

On doing this I get a bit further but it's not quite right. If you take a look at www.christianleadersforum.com.events.asp you'll see what I mean.

Can you shed any light on this?

Many thanks
nathj
Sep 8 '08 #8

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

Similar topics

5
by: Tom Martin | last post by:
I'm a Java Web developer NEWBIE that has inherited a website that fails every 2 hours due to poor connection pooling between Tomcat 4.0.6 and mySQL. In efforts to resolve this problem, I've...
0
by: Robert Mazur | last post by:
MySQL 5.0 alpha (binary install) on Solaris 9 -or- RedHat 8.0 mysql-connector-java-3.0.8-stable ----------------------- Is there something different going on with JDBC and the alpha version...
0
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
5
by: MLH | last post by:
I'm supposed to set a password for the MySQL root user. The output of mysql_install_db instructed me to run the following commands... /usr/bin/mysqladmin -u root -h appserver password mynwewpasswd...
0
by: cwho.work | last post by:
Hi! We are using apache ibatis with our MySQL 5.0 database (using innodb tables), in our web application running on Tomcat 5. Recently we started getting a number of errors relating to...
3
by: tulika dutta | last post by:
after 8 hrs my MySQL connection with JDBC gets time out. It gives the error java.sql.SQLException: No operations allowed after connection closed.Connection was implicitly closed due to underlying...
1
by: vincedav31 | last post by:
I have a connection to a server and my database. I use it like this in my code : Class.forName("com.mysql.jdbc.Driver"); String DBurl = "jdbc:mysql://138.63.222.7:3306/ns3"; m_connection =...
221
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
1
by: spatro | last post by:
Hi, I am trying to install DBD::mysql using the CPAN and I am facing the following error: cpan> install DBD::mysql CPAN: Storable loaded ok Going to read /root/.cpan/Metadata Warning:...
39
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.