Recent: (2 days) Random Pics:   
| | [ less ] [ edit ] [ + ] | | www.anoop.net [ADN] in ASP |
Date Added: 11.20.2004
So I've taken on the project of writing anoop.net in ASP backended by MSSQL (SQL Server 2000) running on IIS.
Right now all my geek friends are probably scowling considering I'm taking on a project with an inferior product.
I started working on this the week of 11/15/2004. I setup MSSQL and I've installed FreeTDS in order to have PHP talk to the MSSQL server. Updates hopefully will be automatic from PHP to ASP so that I don't have to maintain content on two servers. That just seems very stupid.
One of my good friends, Tony Coppoletta rants and raves about ASP and MSSQL. He owns and operates Elevated Consulting. Mike Salins, one of the Senior System Engineers gave me a project which included a slight amount of ASP which I was able to figure out sort of quickly.
For some reason, ASP just looks hideous to me. MSSQL isn't so bad but getting my data from MySQL (the coolest DBS yet) was a pain. Some of the problems I encountered are listed below and also a solution for them.
The data type 'text' is capable of holding up to 2^32 - 1 bytes of data but when you utilize 'text', it is setup as a 16 byte pointer to some node in some tree somewhere...
Solution: In SQL Query Analyzer, you can tell MSSQL to put the actual text into the row itself.
sp_tableoption N'table_name', 'text in row', 'ON|OFF|0|1|#' (F5 will execute the query)
This query will then allow the table you've just designed to hold the text in the row itself as opposed to utilizing some sort of pointer. Why it's using a pointer in the first place is not something I care to know about. MySQL has no problems with it.
Then you can give it a value between 0 and 7000. This can be done either via a query like above where # is the value you want to use or via the table designer which is just an MMC console really.
Importing information (i.e. journals or projects or tutorials) was a pain because those tables had 'text' type attributes in them that included things like ' and " which were escaped anyway automatically by php. ' escaped is represented as \' and " becomes \".
The problem however is that MSSQL is pretty picky about \'. In MSSQL if you are going to print a ' or insert a ' into a row, you must escape it by doing a '' instead.
So... if
' = *single tick*
When inserting rows into MSSQL you will need to use *single tick* *single tick* in order to print the one *single tick*.
A Bad Example:
insert into table1 values ('ADN', 'http://www.anoop.net', 'Anoop\'s website');
will error because of the 3 *single tick*'s in the third value. SQL Analyzer or MSSQL will not be able to parse or execute the query successfully.
The correct Example:
insert into table1 values ('ADN', 'http://www.anoop.net', 'Anoop''s website');
will insert the following
ADN
http://www.anoop.net
Anoop's Website
Pretty bizarre huh?
Escaped double quotes also cause a problem because ASP will interpret is simply as a ending quote and error during execution.
So...if
" = *double quote*
When printing a *double quote* on a webpage, one would need to escape the *double quote* by using *double quote* *double quote* instead of \".
A Bad Example:
<% response.write "Hello \"Anoop\". How are you?" %>
will output
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/index.asp, line 3
response.write "Hello \"Anoop\". How are you?"
--------------------------^
The correct Example:
<% response.write "Hello ""Anoop"". How are you?" %>
will output
Hello "Anoop". How are you?
Which looks normal on a webpage but just looks so awkward to me code wise.
So I wrote a shell script to take MySQL dumps and then convert them so that SQL Analyzer will not complain about them.
This script also includes doing a dump of a full db or a table. I am using mysqldump in order to do the dump and discard the table creation information. as well as removing the \' and \" and replacing it with '' and "".
11/29/2004 So I installed the .NET framework and the SDK and I can't stand ASP.NET!!!
I'm just going to use regular old asp and do what i need to do.
UHH. I'm not writing anything in ASP. Its teh ghey! [less] [edit]
|
|

Perry99.net Ivan Mikan dot Com Ela's Flickr Page qOrbit Technologies Club GP Java.SUN.com OpenBSD ThinkGeek Slashdot Mozilla 7 Dove php.net MySQL IBM 70 Years of Indian Cinema T.M. Ramachandran
|