Monday, November 16, 2009

1&1 Webhosting FAQ | How to set permissions for directories and files?

1&1 Webhosting FAQ | How to set permissions for directories and files?

This really helped me a lot. I had a write permisson problem with 1 and 1 hosting and this seems to show you how to set your permissions correctly.

In the newest version of the site you will just want to find where it says "web files" since it is arranged differently now.

Wednesday, October 7, 2009

Stored Procedure Parameter Order in ADODB Classic ASP

This absolutely matters! If you do not put your parameters in order, particularly your RETURN values have to be your first parameters added, then the program will not work properly! Put everything int he order where you declared your stored procedure.

VB6 ADO SQL2005 StoredProcedure adDecimal Type

VB6 ADO SQL2005 StoredProcedure adDecimal Type

Shared via AddThis

ADODB in javascript- Stored procedure

Here is an example of calling a stored procedure (this inside a classic ASP PAGE) using javascript as your code:

var cn = Server.CreateObject("ADODB.Connection");
var cmd = Server.CreateObject("ADODB.Command");
var para = Server.CreateObject("ADODB.Parameter");
var adCmdStoredProc = 4; //set adodb enumeration value
var adVarChar = 200 ;
var adParamInput = 1 ;
cn.open("DSN", "User", "Pass");
cmd.ActiveConnection = cn;
cmd.CommandText = "procedure";
cmd.CommandType = adCmdStoredProc;
cmd.Parameters.Append(cmd.CreateParameter("@Input", adVarChar, adParamInput, 250));

cmd.Parameters("@Input") = "Input this";
cmd.Execute();

One thing to watch for when passing in a varchar input string: Please make sure when you create the parameter, that you pass in the size of the parameter in the stored procedure as the last input of creation. I had a varchar250 field in this one.

Tuesday, September 22, 2009

Convert HTML Form Elements to ASP.NET form elements

Here is my quick method for converting an HTML page to an ASPX page, handling the controls.
1. First I am going to add runat = "server" to the Form tag. I am also going to remove any function calls that were there previously since I will be replacing it with .NET code. I am removing the action and onsubmit elements from the tag.

Transform to


2. Next I am going to find all the text boxes:

Find
Replace with

If your tags are not arranged with the name following "text" you may need to modify it manually or be more specific with your find/replace

If you are closing the input tag, you will need to manually replace it with a closing
tag. Be careful because there are multiple types of inputs in your form, you do not want to replace all of them.
3. Next, I do the same find and replace with the submit button:

to
runat = "server" ID=
4. Translate your submit action into .NET code behind



EDIT:
The copy and pasting of HTML screwed up the entry I made. I will fix it later.

Monday, September 21, 2009

Send Email in C# Code

Send Email in C# Code

Shared via AddThis
Found this useful tiny code snippit for sending emails in C#. Yes this is basics, but it is nice having a little template you can follow easily.

Thursday, September 17, 2009

The Proper Way to Create a Login Screen for your ASP.NET Website

The Proper Way to Create a Login Screen for your ASP.NET Website

Shared via AddThis
This entry has really helped me create a nice login page.

This also has helped me:
http://msdn.microsoft.com/en-us/library/aa302398.aspx

SqlCommand: Expecting Parameter

This is a simple reminder for myself and you all out there.

If you are using SqlCommand to execute stored procedures, remember to set the command type to StoredProcedure!

SqlCommand cmd = new SqlCommand("storedproc", conn);
cmd.CommandType = CommandType.StoredProcedure;