PDA

View Full Version : MySql in ASP


Mhtml
11-01-2002, 02:38 PM
Can someone help me out here? I've no idea what so ever on how to use sql server or MySQL or whatever it is with ASP some sample code or a link would help.

How does it store the data is there actually a file created? How do you make it create it?

allida77
11-01-2002, 02:54 PM
Everything will look the same except for your connection strings.

For your connection strings use this site:

http://www.able-consulting.com/ADO_Conn.htm

There will also be different functions you can use within your sql statements depending on the db.

dominicall
11-01-2002, 03:20 PM
Currently MS SQL is a bit easier to use for a beginner since it does have a nice GUI front end which makes life a lot easier.

Also, in MS SQL Server you can use Stored Procedures for processing data instead of ADO. Basically, these are pre-written procedures in SQL Server that are pre-compiled on the server and hence they will process data and run more quickly. If you're doing a LOT of data work then you might want to consider MS SQL Server - but it's not cheap.

MySQL is very good (have used that too) but doesn't yet have the GUI that MS SQL Server does - although there are now a number of indepently written GUIs that look pretty good. Also, you can't use stored procedures in MySQL.

The reason I used the word currently above is that I hear that 'Stored Procedure' functionality is being considered/developed for future versions of MySQL. Allied to the GUIs and the fact that MySQL is essentailly free then it becomes a much more attractive choice.

Otherwise, the code is all the same (apart from the connection strings) - it's SQL.

Dominic :D

Mhtml
11-01-2002, 10:26 PM
Phew, I was thinking it was going to be completely different.
I don't currently have any sql server but I know my options.

I judt needed to know so that I can hopefully make my scripts which peeps can dload from my site work on access and an sql server since apparently they handle connections better and some of my stuff is like a bulletin board and content managements scripts.

Thanks.:)

Mhtml
11-01-2002, 10:33 PM
They just changed the rankings, cool I'm a cf addict! YEAH!:)

whammy
11-02-2002, 12:04 AM
Well, except for some small differences (and of course the connection string), which hopefully they would KNOW if they're familiar with ASP, SQL is SQL no matter what you're using, Access, SQL Server, MySQL.

For instance, DateTime in SQLServer vs. Access:

'1/1/2002'
#1/1/2002#

LIKE in SQLServer vs. Access:

LIKE '%myword%'

LIKE '*myword*'

other than little nitpicky stuff like that it's pretty much the same... oh, and Access can't use:

SELECT COUNT(Distinct IP) AS thecount FROM hitcounter

instead, you'd do:

SELECT COUNT(ip) AS thecount FROM (SELECT DISTINCT ip FROM hitcounter)

:)

As for MySQL, haven't used it yet, but I'm sure it's very similar. :)

P.S. One thing I've run into with some people trying to use my regex's is that people using ChiliSoft ASP report errors. This is because ChiliSoft ASP doesn't support regular expressions, which is a shame. :eek:

Hopefully they'll fix that in a future release... but in the meantime I just tell them to find another way to validate the stuff...

Mhtml
11-02-2002, 01:20 AM
I need to learn more on regex, but anywho back on topic is Join only on Sql server?

whammy
11-02-2002, 01:20 AM
Nah you can join just fine in Access... just play around with it. Joins are really pretty easy, once you understand them, you just have to join the tables on a common (primary key in one table, and secondary key in another table) value...

If you want to learn this, go to www.webmonkey.com and take the "Rugged ASP" tutorial. Seriously. I know you will have no problem grasping the concepts at all once you mess around with it... :)

It's custom made for beginners to relational databases, and will teach you most of the basics.

If you don't get it once you've completed that tutorial, then I will explain it in more depth, but not here... I don't think that will be an issue, though.

Basically it's like:

"SELECT * FROM tablename JOIN table2 ON(tablename.id = table2.id) WHERE table2.somefield = somevalue"

That way you get what you what from "tablename" using the criteria you've specified.

Since you seem to be particularly savvy, you might just get that explanation... and once you understand the concept (which wasn't easy for me until I said "duh"... that's all it is?") then you are all set. :)

Mhtml
11-02-2002, 01:48 AM
Lol, I'll do it now..

Mhtml
11-02-2002, 02:17 AM
He he, that was cool. I liked how they wrote that...I should have read that a while ago, also followed a few links gave me more knowledge of sql that's for sure..

whammy
11-02-2002, 02:21 AM
Yeah, did you do everything it said (including downloading their query.asp, etc.)? If not go back and do it again lol. :)

That query tool if you USE it on your own Access stuff will give you invaluable SQL syntax knowledge.

I actually learned stuff from that tutorial (and of course playing around) after developing applications for a year. Actually that Access DB query page they made is really useful if you're using brinkster, with a little modification it beats the heck out of their database manager. :)

Also, consider (just one thing) the "bit" field for instance that isn't described in that tutorial.

Did they explain joins? I don't remember if they explained joins in detail, but if you took that, then you should get how joins work with primary and secondary keys. :)

I'm not trying to be a wicked moderator or anything, but in you I see the potential to teach me in a few months when I need it, since you're 15 and I'm almost 32... hehe us old guys don't learn as fast.

And I like talking with people that like to learn as much as I do. ;)

allida77
11-02-2002, 05:02 PM
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_syntaxc_9kvn.asp


Is a good ref if you plan on building stored procedures.(without a wizard of course)