473,732 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP and MySql - Connection Error

nathj
938 Recognized Expert Contributor
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 3852
JamieHowarth0
533 Recognized Expert Contributor
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 Recognized Expert Contributor
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 Recognized Expert Contributor
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:Navi gtation runat="server"> </Controls:Navigt ation>)?

Best regards,

medicineworker
Sep 8 '08 #4
nathj
938 Recognized Expert Contributor
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:Navi gtation runat="server"> </Controls:Navigt ation>)?

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 Recognized Expert Contributor
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 redistributable s 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 Recognized Expert Contributor
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 redistributable s 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 Recognized Expert Contributor
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
6469
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 created another replica DEVELOPMENT website and upgraded it to Tomcat 4.1.27. I was told this version of Tomcat supports Database Connection Pooling (DBCP) better than previous versions. I followed the instructions as listed at:...
0
4245
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 of MySQL 5.0? When trying to connect I am getting: ** BEGIN NESTED EXCEPTION **
0
3944
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 version of this document can be found at: http://prdownloads.sourceforge.net/souptonuts/README_mysql.txt?download
5
4309
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 I did. It did not work. Here's the error: /usr/bin/mysqladmin: connect to server at 'appserver' failed error: 'Host 'appserver.crci.com' is not allowed to connect to this MySQL server' Another command I'm supposed to run also resulted in an...
0
11702
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 java.sql.SQLException: Deadlock found when trying to get lock; Try restarting transaction message from server: "Lock wait timeout exceeded; try restarting transaction"; We get such errors generally on inserts or updates while applying a
3
5506
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 exception/error: ** BEGIN NESTED EXCEPTION ** com.mysql.jdbc.CommunicationsException MESSAGE: Communications link failure due to underlying exception:
1
1910
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 = DriverManager.getConnection(DBurl,"root",""); It works fine if I start the applet on the server but not on a distant computer. I have a timeout error :
221
367587
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 needs to store entire files, the preferred method is to save the file onto the server’s file-system, and store the physical location of the file in your database. This is generally considered to be the easiest and fastest way to store files. ...
1
4346
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: Found only 0 objects in /root/.cpan/Metadata CPAN: LWP::UserAgent loaded ok
39
5865
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 ISO-8859-1 -t UTF-8 mydb.sql mydb_utf8.sql mysqlCREATE DATABASE mydb_utf8 CHARACTER SET utf8 COLLATE utf8_general_ci;
0
8774
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9307
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
9235
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
8186
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...
1
6735
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4550
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
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2180
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.