Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - MySQL newbie syntax question
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

MySQL newbie syntax question

 Post Reply Post Reply Page  12>
Author
freakdaddy View Drop Down
Groupie
Groupie


Joined: 24 January 2008
Status: Offline
Points: 79
Post Options Post Options   Thanks (0) Thanks(0)   Quote freakdaddy Quote  Post ReplyReply Direct Link To This Post Topic: MySQL newbie syntax question
    Posted: 19 February 2008 at 10:08pm
Hello - I'm trying to learn some of the syntaxing for mysql. I know access real well, and I'm just trying to learn the minor differences. I'm trying to have WWF check for a value in the database (an expiration date), and I created an ASP page to open up the database, but I'm getting the following error:
Microsoft VBScript runtime error '800a01a8'

Object required: ''

It's pointing to the line where I open the database:

    'Query the database
    rsCommon.Open strSQL, adoCon

So obviously something isn't set right. I used the dbconnection(everything is set fine inthsi file as the board runs) include file on this page, and have the following code:

GID = "5" ' just set for sample purposes

        strSQL = "SELECT " & strDbTable & "Author.* " & _
    "FROM " & strDbTable & "Author" & strDBNoLock & " " & _
    "WHERE " & strDbTable & "Author.Author_ID = " & GID & ";"

       
    'Query the database
    rsCommon.Open strSQL, adoCon   
       
    If NOT rsCommon.EOF Then
       
        'Grab users group ID
        ID = rsCommon("Group_ID")


Is this an incorrect way to just get all the fields from this specific Author_ID? Is there something else I need to set with the connection first ( I have to add the closing part of the code of course)? Help is really appreciated. Thanks.
Back to Top
Ralpharama View Drop Down
Newbie
Newbie


Joined: 20 February 2008
Location: England
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ralpharama Quote  Post ReplyReply Direct Link To This Post Posted: 20 February 2008 at 4:38pm
Try:

strSQL = "SELECT * FROM "&strDbTable&"Author"&strDBNoLock&" " & _

...
Back to Top
StarDust View Drop Down
Senior Member
Senior Member


Joined: 14 May 2007
Location: Bangladesh
Status: Offline
Points: 310
Post Options Post Options   Thanks (0) Thanks(0)   Quote StarDust Quote  Post ReplyReply Direct Link To This Post Posted: 21 February 2008 at 8:19am
your SQL string seems correct.

Though it is very rare, sometimes a corrupted database cause this problem.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 21 February 2008 at 9:05am
The part strDBNoLock is only used for SQL Server databases.
Back to Top
StarDust View Drop Down
Senior Member
Senior Member


Joined: 14 May 2007
Location: Bangladesh
Status: Offline
Points: 310
Post Options Post Options   Thanks (0) Thanks(0)   Quote StarDust Quote  Post ReplyReply Direct Link To This Post Posted: 21 February 2008 at 9:37am
Originally posted by WebWiz-Bruce WebWiz-Bruce wrote:

The part strDBNoLock is only used for SQL Server databases.


Bruce isn't wwf use different values for strDBNoLock and strDBRowLock according to strDatabaseType variable value?
Back to Top
freakdaddy View Drop Down
Groupie
Groupie


Joined: 24 January 2008
Status: Offline
Points: 79
Post Options Post Options   Thanks (0) Thanks(0)   Quote freakdaddy Quote  Post ReplyReply Direct Link To This Post Posted: 24 February 2008 at 6:13am
Originally posted by WebWiz-Bruce WebWiz-Bruce wrote:

The part strDBNoLock is only used for SQL Server databases.


Yeah, I was just following the syntax that you guys had in their. It seems to be used all of the time, and it's value was set in another file. So should I take this out when using MySQL?
Back to Top
StarDust View Drop Down
Senior Member
Senior Member


Joined: 14 May 2007
Location: Bangladesh
Status: Offline
Points: 310
Post Options Post Options   Thanks (0) Thanks(0)   Quote StarDust Quote  Post ReplyReply Direct Link To This Post Posted: 24 February 2008 at 11:00am
Originally posted by WebWiz-Bruce WebWiz-Bruce wrote:

The part strDBNoLock is only used for SQL Server databases.


Freadkdaddy, as Bruce said, it is only used for SQL Server databases.

However there is another variable which controls the value of "strDBNoLock". This variable "strDatabaseType". When you set strDatabaseType = "mySQL" in database/database_connection.asp off WWF installation, strDBNoLock becomes an empty variable with no value. So, it is all the same using the variable or not. But make sure you have a trailing space in your SQL syntax after these variables.
Back to Top
freakdaddy View Drop Down
Groupie
Groupie


Joined: 24 January 2008
Status: Offline
Points: 79
Post Options Post Options   Thanks (0) Thanks(0)   Quote freakdaddy Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2008 at 7:02am
Thanks... so technically, this should work?

     strSQL = "SELECT " & strDbTable & "Author.* " & _
"FROM " & strDbTable & "Author" & strDBNoLock & " " & _
    "WHERE " & strDbTable & "Author.Author_ID = " & GID & " " &";"

Do I need the end semi-colon or not? I dunno, but I just need some kind of syntax for mysql so that I can open the database and select data from the author_ID table. So lost at this point. Wasn't expecting it to be this difficult to find the correct format. Unhappy
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.