frontpage and mysql coding question (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


crosscreek -> frontpage and mysql coding question (2/28/2008 11:05:33)

I need a suggestion of help with coding. I am using frontpage 2003 & mysql database.

I am learning ASP coding & am quickly learning that there's many ways to do things.

I am trying to set up a simple Detail page where someone can see details in a mysql table. I am pretty certain that I am missing a code that will select the table, but anyway I type it I can't seem to get it to work. Below is my base code

The connection works fine, but keep getting a option explicit error. there are many fields in the tbldog, but I am trying to show 1 field (name) at the moment. Just for simplicity sake.

I've tried adding
Dim MySQL the used
MySQL = "SELECT * FROM tbldog" Still no luck. What am I missing?


<%@ Language=VBScript %>
<% Option Explicit %>
<!-- #include virtual="/adovbs.inc" -->
<!-- #include file="openconn.inc" -->
<%
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "tbldog", myConn, , , adCmdTable
Do White Not objRS.EOF
Response.Write "name: " & objRS("name")
objRS.MoveNext
Loop
objRS.Close
Set objRS = Nothing
myConn.Close
Set myConn = Nothing
%>




rdouglass -> RE: frontpage and mysql coding question (2/28/2008 12:07:38)

quote:

<% Option Explicit %>


Try turning that off. If you have it being declared in one of your include files, that would cause issues.

Just stick an apostrophe in front temporarily just to confirm.

<% 'Option Explicit %>

That help any?




crosscreek -> RE: frontpage and mysql coding question (2/28/2008 12:28:00)

That did work. When I turned it off I found an spelling error, then I saw the dog's name...

When I turned it back on I received the error again. Do I need to have the Option Explicit?




rdouglass -> RE: frontpage and mysql coding question (2/28/2008 16:07:10)

quote:

Do I need to have the Option Explicit?


Only in rare circumstances have I seen it make a difference. It is usually used in cases where you want to have Public and Private functions or to use the same variable name twice. It basically just requires you to DIM all variables (which is not necessarily a bad thing BTW).

I never use it but you don't want to use it twice. Personally, I'd remove it everywhere and see if anything 'breaks'.

Hope it helps.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625