Dec 04 2008

MSSQL Stored Procedures and Classic ASP

Published by Sherwin under Programming, SQL

A client at work wanted us to create a way to duplicate existing records on their website with a click of a button. These records involve multiple tables in the database. Some of the tables contained a lot of columns. We tried to do most of work using ASP but sometimes the browser would time out and Dreamweaver would crash.

Then I thought, why don’t we have our SQL server do most of the heavy lifting. I created a stored procedure that query the database for the record(s) that need to be duplicated and have them duplicated. Below is a short example to get you started.

First you need to create a stored procedure in SQL Server.

CREATE PROCEDURE stored_procedure_sample
@record_id INT OUTPUT

AS
BEGIN

INSERT INTO table_name (column1, column2, column3)
SELECT column1, column2, column3
FROM table_name
WHERE record_id = @record_id

END;

GO

Next you need to create the ASP page that process the request. You can use form variable or URL query string. For the example, I will use a form variable. Let’s imagine on page1.asp there is a form with a hidden variable that contains the record_id you want to duplicate. You submit this to page2.asp and here’s a sample of what page2.asp should look like.

<%

Dim connString, rsCmd

connString = “your connection string”
Set rsCmd  = Server.CreateObject(”ADODB.Command”)
rsCmd.ActiveConnection = connString
rsCmd.CommandType = 4
rsCmd.CommandText = “stored_procedure_sample”

rsCmd.Parameters.Append rsCmd.CreateParameter(”@record_id”, 200, 1, 4, Request.Form(”record_id”))

rsCmd.Execute

%>

What page2.asp does is it takes the form variable “record_id” from page1.asp and tells the stored procedure to get the values for this record and insert it as a new record. That’s pretty much it. Just a short, simple example on how you can create a stored procedure in MSSQL Server and use it with classic ASP.

No responses yet

Dec 02 2008

Moon, Jupiter and Venus alignment 2008

Published by Sherwin under Anong Balita

My friend Robert texted me last night to look up in the sky and find the moon. There was an alignment happening between the Moon, Jupiter and Venus. I looked up and there it was, the Moon and the 2 planets. At first I thought they were starts but as I kept looking they appeared a lot brighter and larger than the stars I normally see. I tried to take some pics on my iPhone and G9 camera. They didn’t turn out that well but I’ll share them anyway. The alignment is supposed to make a “smiley” face. The 2 planets are the eyes and the phase of the Moon would be the smile. Pretty cool stuff.

Here’s a video from Youtube that I found.

No responses yet

Nov 30 2008

My first pairs of Clarks Wallabees

Published by Sherwin under Sole Collector

I’ve been wanting a pair of Clarks Wallabees for a while now and I finally bought 2. It was the night before my co-worker’s wedding and I wanted to buy a pair of shoes to wear. I have a pair of black Timberlands that I wore in the past but they were uncomfortable. Abby was at Ontario Mills that day so I met up with her after work.

I decided to check out the Clarks store since I was already there. They had a sale, buy one get one at 25% off. I found some black, suede ones that I had my eye on the last time I was there. They feel so comfortable, it’s like walking on a matress. The guy also brought out the last pair of some canvas ones. They were nice and I haven’t seen them before so I bought them too. Abby liked the suede ones too so I bought her a pair too. So for 3 pairs of Clarks Wallabees I spent around $220 - not bad I thought.

No responses yet

Nov 27 2008

iPhone 2.2 released

Published by Sherwin under Anong Balita, OS X, Technology

Apple has recently released iPhone version 2.2. Safari has been updated and now has the Google search box next to the URL box. I don’t like it myself since it looks like it was squeezed in there. There are other fixes and updates but…

I’ve been waiting for this for a long time. The iPhone 3G is an international and supports multiple languages. But what if your country isn’t listed and you want to text or email people in your native language that isn’t supported? Well for months I was faced with this and the auto-correction bugged the crap out of me until I hacked my iPhone just so that I can disable the auto-correction. But now, Apple has finally implented the setting and am back to the original settings.

Why did it take so long Apple?

No responses yet

Nov 13 2008

WoW WotLK

Published by Sherwin under Anong Balita

It’s finally here, World of Warcraft’s second expansion, The Wrath of the Lich King. I picked up the limited edition package with the mouse pad, dvd installer (I hated reinserting those CDs), behind the scenes DVD, art book and an in-game pet. I figured might as well pay the extra $ since I had some gift certificates to use up.

I’ve played about an hour of it so far earlier. I got my Death Knight made. You must have an available character slot in order to create one. You start off in Eastern Plaguelands at level 55. I’ve done a couple of quests with her already. A mount can be summoned once you complete a chain quest (2).

After messing with that, I changed on to my Paladin toon and did a couple of quests in the new lands. Some of the green gear I saw as rewards will already replace any existing blue gear you have.

So now I’m home and have installed it on my iMac and I come to this…

I captured the image 30 minutes after I logged in… and still waiting. This is worse than when The Burning Crusade expansion came out. Oh well…

No responses yet

« Prev - Next »