Thursday, January 11, 2007

Mixing client side scripts with ASP.NET

Adding javascript events to ASP.NET objects

This adds cient side events to server posting asp.net objects

aspnetobjecthere.Attributes.Add("onClick","functionhere()");

where functionhere() is a javascript function

Thursday, December 07, 2006

Hey!!

It seems ages since I blogged on here! Again personal stuff and school work taking over right now! Anyway couple of cool things to blog today, first up

Wii Drums!

Even if your not a drummer you'll find this cool, how long has the wii been out??!:P

http://www.youtube.com/watch?v=8FftLxuYzRA&eurl


OnlineTV
This site is a collection of a load of US streaming TV channels,watched a music one for a while tonight! quite nice!

http://www,streamick.com

Monday, October 16, 2006

hehe!

Friday, October 06, 2006

I'ts bin a while!

Not posted on here for aaages! well atleast it feels that way. The reason being work and school work! Today i decided to post this video up. Its amusing and really shows the power of the half life 2 engine, you know the one that also powers Counter Strike!!!

Tuesday, September 26, 2006

Vista Technology

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnintlong/html/longhornintro.asp

This is a great article i found which covers a lot of new technologies in vista, including XAML (WPF), WinFS (not shippin , but an update). I used it mainly for learning some xaml markup and linking xaml to my c# event handlers but its a good read. Also documents Indigo, the new network comunication system in Vista (alternative to sockets)

Factoriser!

This online tools instantly factorises any linear, quadratic or cubic expression

http://www.hostsrv.com/webmab/app1/MSP/quickmath/02/pageGenerate?site=quickmath&s1=algebra&s2=factor&s3=basic

Saturday, September 23, 2006

http://www.codeproject.com/useritems/cameraviewer.asp

this is a great articel on IP cctv cameras. it has good information on web requests, sending credentials insid ethe request (such as usernames and passwords). Also has some cool Bitmap techniques. Worth a proper read when i get time!!

Monday, September 18, 2006

C++ Tutorial

Sunday, September 10, 2006

.Net Common Solutions Index

A very usefull page, full of the pretty basic things you forget:P

http://www.codeproject.com/useritems/tips.asp

Friday, September 08, 2006

.net Drag and Drop Objects

http://www.codeproject.com/csharp/dandtutorial.asp

Very useful drag and drop tutorial for .net apps

Wednesday, September 06, 2006

backup BAT

awesome windows command shell script seting variables n paths to automate backingup using the xcopy method. I hope to build a nice interface for creating backup batch files

http://www.hak5.org/wiki/index.php?title=Backup_Using_Batch_Files

Tuesday, September 05, 2006

Cool google data visualisation

Had to post this. Brighter light represents amount of hits to google.com throught the day


click for bigger image

Quick Ref

Heard some hype about this a while back, basically its your first stop for looking up some kind of programming variable, function, class etc.

Tried a few searches and looks really good for web / php / java developers. Couldnt find any resources for .net or asp though which is a pitty.

http://www.quickref.org/

Tuesday, August 29, 2006

UK Based Developers Forum

http://www.developerfusion.co.uk/forums/

Came across this today looks promising

IP to Location

http://api.hostip.info/flag.php?ip=12.215.42.19

this can be used in an image tag and returns an image of the flag of the country , the IP address originates from. removing the ip query string returns the flag of the visitors country , not the flag of a specific IP address.

Example




Sunday, August 27, 2006

Dates!

I took this evening out to play aruond with dates n times , with regards to inserting and retrieveing and manipulating to and from a database.

fisrt things first, in a sql insert you can use Now() to put the date and time into most databases, provided that the filed is cast as a Date/Time field.

example

insert into mytable ('id','text',Now(),'helooo');


so now you have a workable date in your table.

This is fine but you want to bind them to a DateTime type in .net when you read them. This allows you to do example...

bindeddatetime.Hour
indeddatetime.ToShortDateString();

etc etc.

to do this, simply convert the data from your data reader

Example

while(mydatareader.Read())
{

DateTime thedate=Convert.ToDateTime(mydatareader["timefield"]);
//notice time field not converted to string at all, just binded straight to a DateTime
}
Conclusion

Your timestamp is now in a format ready to
  • manipulate,
  • sort ( ORDER BY DATE DESC)
  • add, time difference, etc
Associated links

Server Side Web Request

Here is how to read a web request in c#

Reference

using System.Net;
using System.IO;

Code

WebResponse temp=WebRequest.Create("http://www.google.co.uk").GetResponse();
Stream temp2 = temp.GetResponseStream();
StreamReader test = new StreamReader(temp2);
Response.Write(test.ReadToEnd());
test.Close();

Sunday, August 20, 2006

Autorun Structure

filename autorun.inf

Structure


[autorun]

action=anynamehere
shellexecute=filename.bat

Useful Firewall Command Line code

show firewall config

netsh firewall show config

disable firewall

netsh firewall set opmode disable

enable firewall

netsh firewall set opmode enable

open a port ('delete' can be used in place of 'add')

netsh firewall add portopening TCP 80 genericnamehere


Saturday, August 19, 2006

A Good RSS 2 Spec

Good guide to all elemets of valid rss 2. Very useful for those providing either static or dynamic web syndication

http://blogs.law.harvard.edu/tech/rss

Internet Connection Speed Test

Clear, Concise and visually impressive.

Best speed checker i have encountered as yet, implemented in flash.

http://www.speedtest.net/index.php

Friday, August 11, 2006

Cool Focus Blackout

I noticed lately that a lot of sites try to mimic windows focusing by bluring out the website and placing a focused window ontop. To see what i mean goto

http://www.on10.net and click login

this can be achieved quite easily.


put the following div in your page (where "testing123" can be changed)

<div id="testing123" style="filter: alpha(opacity=0); -moz-opacity:.0; background-color:Black;width:10px; height:100px;">

focused content here

</div>

next use this function to set the focus

function blankscreen()
{
document.getElementById("testing123").style.width=screen.width+"px";
document.getElementById("testing123").style.height=screen.height+"px";
document.getElementById("testing123").style.position="absolute";
document.getElementById("testing123").style.left="0px";
document.getElementById("testing123").style.top="0px";
document.getElementById("testing123").style.zIndex="10000";
}

to unfocus use something like

document.getElementById('testing123').style.display="none";

Access Error

After debuging my site on my local machine with no problems I decided to upload it to the server.
For ages I was getting ODBC errors and figured out that the directory in which you access database resides must not be "read only". The errors said the file could not be found, but the real problem was becuase it makes temporary files in the same directory whilst accessing the database and my folder was read only. Handy to know...

Cool Fade Javascript

This fade script can be applied to any div tag or element.

function opacity(id, opacStart, opacEnd, millisec) {
//speed for each frame
var speed = Math.round(millisec / 100);
var timer = 0;

//determine the direction for the blending, if start and end are the same nothing happens
if(opacStart > opacEnd) {
for(i = opacStart; i >= opacEnd; i--) {
setTimeout(\"changeOpac(\" + i + \",\'\" + id + \"\')\",(timer * speed));
timer++;
}
} else if(opacStart < opacEnd) {
for(i = opacStart; i <= opacEnd; i++)
{
setTimeout(\"changeOpac(\" + i + \",\'\" + id + \"\')\",(timer * speed));
timer++;
}
}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
var object = document.getElementById(id).style;
object.opacity = (opacity / 100);
object.MozOpacity = (opacity / 100);
object.KhtmlOpacity = (opacity / 100);
object.filter = \"alpha(opacity=\" + opacity + \")\";
}

Example Usage

this would fade in fully over 5 seconds

opacity("mydivtag",0,100,5000);


this would fade out fully over 3 seconds

opacity("mydivtag",100,0,3000);

Thursday, August 10, 2006

Ubuntu on TV

Ubuntu makes it to TV!

http://www.channel4.com/more4/news/news-opinion-feature.jsp?id=350

Follow the link to watch a More 4 interview with Mark Shuttleworth, talking about the success of Ubuntu ( a linux distribution ). Quite interesting, I never realised he had been to space!

Tuesday, August 08, 2006

Loading Items From Resource Manager

Ok, so today I found something quite simple but worth knowing. Lets say you have an PictureBox and you want to use an image in your resource manager.

pictureBox1.Image = global::desktidy.Properties.Resources.imagenamehere;

you can change imagename here to any item stored in the Resource Manager.

Sunday, July 30, 2006

C++ stuff

So today I did a refresher on some basic C++ stuff. I thought i'd just note down a few things worth remembering.

Writing / Reading from console app

Here there are 2 prerequisites

#include <iostream>

this line includes the input output stream for the console and...

using namespace std;

this line is required to utilize the standard namespace, giving access to functions like cin and cout (console input and output)


Functions

One thing i'm finding hard to come to grips with is the fact that any functions you use must be declared beforehand, for example

int go(int inputargument);

then....

int go(int inputargument)
{
logic
}

Strings

To use strings in C++ you must

#include <string>

with optional extras for dealing with strings

#include <cstring>
#include <sstream>

sstream is is "String Stream" which allows you to convert integers to strings like so

int mynum=5;
string temp;
stringstream ss;
ss<<mynum;
temp=ss.str();

Definitions

also, any variable that willnot change throughout the whole app can be declared underneath any includes using

#define variablename value

example

#define maxnumber 100

Wednesday, July 26, 2006

Getting HTML into a database

Today I found a great function in ASP.net to convert user inputted string into a format suitable to be held in a database.

The first thing you must do is turn off ValidationRequests. Validation requests are a system .NET has in place to immediately stop the user inputting html into any form . But sometimes you need to allow this. CHanging the ValidateRequest attribute of the text entry and submission button didnt work for me , im not sure why, but if the following is included in the webconfig then the user is allowed to submit html through a form (this will compromise security and should be odne with caution).

<system.web>
<pages validaterequest"false">

</pages>

At this stage your webapp can now handle html being submitted, but before it can be inserted into a database it must be converted into escape characters.

Here is an example of how to do so, where userinput is plain html entered by the user

string encodedinput=HttpUtility.HtmlEncode(userinput);

this html data can now be inserted into any database using an SQL command. There is no harm using this method on all form submisions, even if they are not likely to contain html. The reason for this is the encode function will also encode illegal charcaters such as double quotes (\") & % and @ symbols which will be rejected by the database.

When retrieving this encoded html from the database it can easily be dedoded back into regulr html using

string decodedhtml=HttpUtility.HtmlDecode(htmlfromdatabase);

If used carefully, along with SQL injection prevention techniques, this makes for a safe way to store scripts and html in a database.

Avioding SQL injection

after much playing around and problems i finally figured how to add safe parameters into an odbc command. Here is a sample....

OdbcCommand postcomment = new OdbcCommand("insert into comments values ('"+newguid+"','"+itemid+"',?)", temp);

Here the ? represents the first and only parameter to be passed into the command using..

postcomment.Parameters.AddWithValue("@comment", comment);

then

postcomment.ExecuteNonQuery();

If you were to include > 1 ? symbols, the parameters must be added in the order they appear in your original command.

Monday, July 10, 2006

Delegates in .NET

After browsing many over complex delegate articles I think i have established their real use. Say you have a class A with a function DoWork(). At the end of the DoWork function you need a certain event to be triggered but this event could change at any given time whilst the app is open.

To solve this you would create a new instance of a delegate called mytask

public delegate void mytask();

then in your class A's Do Work function you pass in the delegate as a parameter

public void DoWork(mytask g)
{

Response.Write("hello");
//here the custom function is executed//
g();

}

before this will work you need to add events or functions to the delegate, before it is passed into the DoWork function.

example

mytask thetask=new mytask(); //make a new instance of the delegate
thetask+=new mytask(someobject.somemethod); //assign the event to the delegate
ClassA temp=new ClassA(); //make a new classA
temp.DoWork(thetask); //tell classA to DoWork and 'thetask' will get executed in there
Response.Write("done");

NOW! once the DoWork is called for the temp object, inside the DoWork method, someobject.somemethod is executed ( before the response.write("done") ).

In conclusion the delegate object is like a cast for a function to be executed, you are passing an event into a function to be executed.

NB, in this example my delegate was a void, if the function you want to pass in returns a value you have to match it to a string delegate or double delegate etc etc.

For a more detailed explanation see

http://www.superdotnet.com/Article.aspx?ArticleID=192

Saturday, July 01, 2006

Great SQL tutorial

Great site broken down into sections , great for reference

http://www.webdevelopersnotes.com/tutorials/sql/index.php3

also note to self,

use cmd to browse to mySQL/MySQL Server 5.0

then use mysql -u root -p

and wait to be prompted for a password,

Key Commands

show databases;
use database_name;
show tables;
descibe table_name;

Friday, June 30, 2006

Master Page User

I recently found that the User object cannot be accessed directly from inside a master page (as it can from any standard aspx page). To do so you need the following code;

HttpContext.Current.User.Identity

Wednesday, June 28, 2006

Blogging Code!

If you see my previous post I have posted some XML (for some web.config settings)

However, blogger hates this stuff and simply pasting in the XML didn't work (as it interpretted the xml as part of the html in the page!) so I figured it needed converting to esape characters...

Solution

http://accessify.com/tools-and-wizards/developer-tools/quick-escape/

:)

Advanced Forms Authentication

Tonight I realised that with normal forms authentication on, a linked css file (from a link tag in head) will not load on the login page before a user logs in, so the site has no css before the user logs in!!

Solution

right before the </configuration> in the web.config file add...

<location path="myskin.css">
<system.web>
<authorization>
<allow users="*">
</allow>
</authorization>
</system.web>
</location>

replace myskin.css with any file you wish to grant unauthorised access to! :)

Thursday, May 25, 2006

Jpeg META Data

Reading JPEG Meta Data in c#

http://www.aspjpeg.com/manual_06.html

Article shows how to extracts jpeg meta data from a file such as resolution, camera make / model , etc etc.

Wednesday, May 17, 2006

Sunday, April 30, 2006

Storing connection strings securely

Good article on how to encrypt / decrypt a string

http://www.codersource.net/asp_net_security_connection_string.aspx

Wednesday, April 26, 2006

Interesting DB / XML Article

http://www.developer.com/net/vb/article.php/10926_1540311_7

Very good article explaining best practices for database access and useful info on parsing a structured xml file

Saturday, April 22, 2006

AJAX Load Gif Maker !

Cool gif generator. Makes gif loading animations, good to use on ajax pages as data is being dynamically loaded into the page,

some styles look very mozilla!:P

http://www.ajaxload.info/

Very good basic AJAX tutorial

simple AJAX tutorial, goes through sending a request to the server (as a querystring) and getting the response text, and applying it to a div tag

http://rajshekhar.net/blog/archives/85-Rasmus-30-second-AJAX-Tutorial.html

Notes

Create a new XMLHTTP request object named "http"

function createRequestObject() {
var ro;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
ro = new ActiveXObject("Microsoft.XMLHTTP");
}else{
ro = new XMLHttpRequest();
}
return ro;
}

var http = createRequestObject();
Create a request sender poining it to an aspx page with the querystring "number" and tell it which function to use to handle the request ("handleResponse")

function sndReq(thenumber) {

http.open('get', 'example1service.aspx?number='+thenumber);
http.onreadystatechange = handleResponse;
http.send(null);
}

above; the "example1service.aspx" page simply takes the querystring and Response.Write 's it* 10 (for example) , also a try/catch for if the data sent was not an integer.

NOTE: the example1service.aspx page has ContentType="Text" in the header


Create the request handler "handleResponse", returnpanel is a div tag to recieve the contents of the request.

function handleResponse() {


if(http.readyState == 4){
var response = http.responseText;

document.getElementById('returnpanel').innerHTML = response;

}

}

THE HTML

The HTML is simple a text input field which fires the sndReq() function on the keyup event, sending its own value as an argument , example

onkeyup="sndReq(form.inputtextbox.value)"

The html also contains the div tag to display the response with id="returnpanel"








Thursday, April 20, 2006

Dynamic XML

Today I was playing round with rss feeds. Never used them before so i first wrote a static rss feed, saved as xml and worked fine :D

Next i tried writing some c# code to generate RSS on the fly and had problems!

Things to remeber for dynamic rss in .net

  • Make sure every dynamic item has a title, description and a link tag with a VALID link
  • make sure the header of your page has ContentType="XML" example...
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Dynamicfeed.aspx.cs" Inherits="Syndication_Dynamicfeed" ContentType="XML"%>
  • If you do not set the content type, then any rss aggregators think the aspx file is xhtml and not a valid xml feed. without the ContentType attribute, your rss is invalid.

Wednesday, April 12, 2006

Text Merging Application

Today I sat down and wrote this app. Its a fairly basic program which allows you to merge an unlimited number of text based files into one output file. Here are a few of the features...


  • Manually enter filenames to merge

  • Scan a directory, merging all the files inside

  • Scan a directory merging all the files of a specific type



Usage
How can i use this?? well here are a few ideas


  • Combine a folder full of html webpages into one webpage example

  • Merge a set of javascript files into one script

  • Merge separate CSS files into one big .css document



Download

Executable (.zip)
c# Source Code

Note: You will require .net 2 to run this application

Tuesday, April 04, 2006

reading XML Rss Feeds in ASP.NET

Wednesday, March 29, 2006

Creating a Datatable

http://www.c-sharpcorner.com/Database/DataBindingInDataGridMCB1.asp

This link shows you how to create a c# Data table, add rows to it, then bind it to a DataGrid. Very Usefull!

Saturday, March 25, 2006

Show/Hide page element in one function

I wrote the function below in javascript, it has 0 arguments. This function checks and sets the element "emotions" (an emotions panel in a blog i am making). This wil make the emotions div tag visible/hidden alternating each time the function is run.

function hideemo()
{
if(document.getElementById('emotions').style.display == 'none')
{
document.getElementById('emotions').style.display = 'block'
}
else
{
document.getElementById('emotions').style.display = 'none';
}
}

Tuesday, March 21, 2006

Custom 404

This site shows you how to customise your 404 error page in IIS just incase you forget! This article describes the IIS 4 method but from the screenshot it looks adaptable to later versions.

http://www.4guysfromrolla.com/webtech/061499-1.shtml

Saturday, March 04, 2006

XML Parsing

Today i started work on a desktop cleaning / sorting application called DeskTidy. I realised that I wanted to store a list of user defined filters for automatically tidying the desktop (based on filesize, type, age etc etc). The best way to store such information seems to be an XML document, so after research I found this document showing how to read an XML document from inside c# .NET, making use of the XMLTextReader object.

http://www.codeproject.com/csharp/csreadXml1.asp

or



This should come in handy for anyone wanting to read an XML document from c#.NET. The object loops through nodes inside the xml and picks out variables. I think it can also cache and parse remote XML files from a URL (anyone making yet another rss reader?), not something I have tried though. In addition to the XMLReader object, the object XMLWriter exists to do pretty much the opposite. Here is some msdn coverage of the object

MSDN Article

Hope this is useful!

Wednesday, December 07, 2005

SQL Code tutorial

mySQL Essentials

The following are vital to connect asp.NET to mySQL databases

The mySQL drivers

(.net api available from http://www.mySQL.com)

ODBC adapter for .NET

http://www.microsoft.com/downloads/release.asp?ReleaseID=35715

Monday, December 05, 2005

Connecting to MySQL from asp.NET

To connect to mySQL from .net 2 things are required

odbc .NET connector (available from microsoft.com)
mySQL .net adapter (available from MySQL site)

then, in c#

DECLARATIONS

using System.Data.Odbc;

CONNECTION (written from memory as a guide)

string connectionstring="Driver={mySQL};Server=data.domain.com;Port=3306;Option=131072;Stmt=;Database=my-database;Uid=username;Pwd=password;";

odbcConnection goconnect = new odbcConnection(connectionstring);
goconnect.Open();
odbcCommand insertsumat=new odbcCommand("insert into tablename values('fred',17')",goconnect);
insertsumat.ExecuteNonQuery();
odbcCommand retrievesumat=new odbcCommand("select * from users where name like 'tom'",goconnect);
odbcDataReader readit=retrievesumat.ExecuteReader();
while(readit.Read())
{
Response.Write(readit["fieldnamehere"].ToString());
}
readit.Close();
goconnect.Close();

Thats pretty much it, used in same way as a OleDB connection to an access database, just using a different adaptor (odbc) and a new connection string. Any probs check port matches that of mySQL.

Wednesday, November 09, 2005

Draggable DIV tags

Make any div tag on the page "draggable"

http://www.dynamicdrive.com/dynamicindex11/genericdrag.htm

Tuesday, November 08, 2005

Begginers guide to PHP

http://www.zend.com/php/beginners/index.php

Great tutorials for learning PHP from scratch, get PHP from

HERE

ASP.NET Forms Authentication

This allows one page to act as a global login page, and no other page to load unless part of a session, created by a successful login comand from the login page. Much securer than passing query strings.

http://www.howtodothings.com/ViewArticle.aspx?Article=31

or

http://www.15seconds.com/issue/020220.htm

Dynamic Images in ASP.NET

Site covering three tutorials on how to create images "on the fly" using asp.net

http://www.developerfusion.co.uk/show/4648/

Tuesday, August 30, 2005

Writing dynamically to an asp page

first create a new panel object and name it, set its width to 100% and delete out any text

then use..

Panelname.Controls.Add(new LiteralControl("string"));

to add to it :)

Wednesday, August 24, 2005

Closing c# Windows Apllication

Application.Exit();

easy! :D

Thursday, August 18, 2005

Searching Database

This could be handy when wanting to search through a database, a bit like a search engine...

SQL Command.

select * from tablename where columname like '%stringhere%'

Monday, August 15, 2005

how to check if first load in asp.net

on the page load event....

if(!IsPostBack)
{
//very first load//
}
else
{
/not first load//
}

Saturday, August 13, 2005

Always Sync

Sync folders, looks good for mp3 player!

www.alwayssync.com

merging cells

if you want a table which has for example

3 cells in row one, then...
1 cell in row 2

inside the cell that you want to stretch use the function colspan,



the code above would work for the given example

Monday, August 08, 2005

Sending / retrieving asp variables

This shows how to send variables to an asp.net page (usualy from a hyperlink)

To Send...

pagename.aspx?variablename=value&variablename=value

(& etc etc)

To Retrieve (in c#code)....

string savethis=Request.QueryString["variablename"];

Friday, August 05, 2005

Connections.....

This site shows all the connection string for connecting to any database from.net

http://www.connectionstrings.com/

connecting and using access to store data from .net

This can be used in either a windows application OR an asp.net file.

NOTICE: if using with asp.net file the access file MUST be placed and refered to in the ROOT directory of IIS.


ok, first make the reference

using System.Data.OleDb;

to open and close connection....

OleDbConnection thisConnection = new OleDbConnection(
@"Provider=Microsoft.Jet.OLEDB.4.0;" +
@"Data Source=E:/WEB_SERVER/server_user_database.MDB");
thisConnection.Open();
//work here//
thisConnection.Close();

to add data...

OleDbCommand new1 = new OleDbCommand("INSERT INTO tablename (column(s)) values('valueshere')", thisConnection);
new1.ExecuteNonQuery();

to retrieve data...

OleDbDataReader myReader=null;
OleDbCommand test = new OleDbCommand("select * from tablename, thisConnection);
myReader = test.ExecuteReader();
while(myReader.Read())
{Label1.Text=(myReader["columnnamehere"].ToString());};
myReader.Close();

always close connection!!!...

thisConnection.Close();

Thursday, August 04, 2005

Executing a program

System.Diagnostics.Process.Start("filename.exe");

Creating a new file and writing to it

Remember to reference

using System.IO;

StreamWriter test =new StreamWriter("C:/new.txt");

test.Write("helo");
test.Close();

Wednesday, August 03, 2005

Notes on SQL Server

NB: any SQLSERVER code is in red

Include the reference;

using System.Data.SqlClient;


to connect and open...

SqlConnection myConnection = new SqlConnection("user id=SQLSERVERUSERNAME;" +"password=SQLSERVERPASSWORD;server=SERVER PATH HERE, USE . IF LOCAL;" + "Trusted_Connection=yes;"+ "database=DATABSE TO CONNECT TO; ");
myConnection.Open();

NOTE: Connection must be made EVERY time data is added / retrieved

To Add Data the connected Database....

//create new command to add data//
SqlCommand COMANDNAMEHERE=newSqlCommand("INSERTINTO tablename(collumname) " //here colum names can be comma seperated//
+ "Values (valuetoadd)", myConnection);//here the values to add can be comma seperated//

// myConnection is name of establishd connection//

//this command will insert new value (valuetoadd) into tablename in specified column//
COMMANDNAMEHERE.ExecuteNonQuery();
//run command//

To Retrieve Data from the connected Database and assign to a label....

SqlDataReader READERNAMEHERE = null; //create new reader object//
//create new command to retrieve data//
SqlCommand COMMANDNAMEHERE = new SqlCommand("select * from tablename where collum LIKE 'value', myConnection);
//this command selects all the values from the table where the value appears in the collum//
READERNAMEHERE = COMMANDNAMEHERE.ExecuteReader();
//code above runs the command into the reader and starts it 'reading'//
while(READERNAMEHERE.Read())
{
labelname.Text+=myReader["Collum"].ToString();
}
//while ever the reader is reading, grab the values from the collumn and add them to a multiline text box//

CLOSE THE CONNECTION (Must be done after data has been added / retrieved)

MyConnection.Close(); //myConnection is the name used when creating connection//

Great SQL Tutorial

Shows how Connect and how to add / read data

http://www.codeproject.com/cs/database/sql_in_csharp.asp

Tuesday, August 02, 2005

Decent SQL Tutorial

Saturday, July 30, 2005

checking the value of a HTML combo box

Example

 


<form name="testform">

<select name="tom"><option value="http://www.google.co.uk">Google</option></select>

</form>


Check this variable;


testformtom.options[testform.tom.selectedIndex].value

Opening and Writing to new browser window

1. Start the function function open_it(name) {
2. Define the contents contents = "hello there "+name;
3. Start the new window

anynamehere=window.open("","windownamehere","options");

4. Write the contents to the window, anynamehere.document.write(contents);
5. Finish and open the window, anynamehere.document.close();
6.End Function }

NOTE: Options can be...

"toolbar=0,status=0,menubar=0,scrollbars=0,resizable=0,
width=300,height=200"








Wednesday, July 27, 2005

Javascripts

Cool script site

http://a1javascripts.com/

Switching Stylesheets

Great sites

Great sites for content and tutorials on

  • Web Interfaces
  • Photoshop Graphics
  • Web Programming
http://www.spoono.com/
http://www.absolutecross.com/
http://www.guistuff.com/ (tomtech999)

Tuesday, July 26, 2005

Cool text generator site

Similar to cooltext

www.theimagecreator.com