IE5.5 Popup's
Here's the quick and dirty escape sequence string function to assist converting code from C# to VB.NET.
Function EscapeString(ByVal s As String) As String
'\' - Single quote 0x0027
If s.IndexOf("\'") > 0 Then
s = s.Replace("\'", "'")
End If
'\" - Double quote 0x0022
If s.IndexOf("\" & Chr(&H22)) Then
s = s.Replace("\" & Chr(&H22), Chr(&H22))
End If
'\0 - Null 0x0000
If s.IndexOf("\0") Then
s = s.Replace("\0", Chr(&H0))
End If
'\a - Alert 0x0007
If s.IndexOf("\a") > 0 Then
s = s.Replace("\a", Chr(&H7))
End If
'\b - Backspace 0x0008
If s.IndexOf("\b") > 0 Then
s = s.Replace("\b", Chr(&H8))
End If
'\f - Form feed 0x000C
If s.IndexOf("\f") > 0 Then
s = s.Replace("\f", Chr(&HC))
End If
'\n - New line 0x000A
If s.IndexOf("\n") > 0 Then
s = s.Replace("\n", Environment.NewLine)
'or s = s.Replace("\n", vbLf)
'or s = s.Replace("\n", Chr(10))
'or s = s.Replace("\n", Chr(&HA))
End If
'\r - Carriage return 0x000D
If s.IndexOf("\r") > 0 Then
s = s.Replace("\r", Chr(&HD)
'or s = s.Replace("\n", Chr(13))
'or s = s.Replace("\n", vbCR)
End If
'\t - Horizontal tab 0x0009
If s.IndexOf("\v") Then
s = s.Replace("\v", Chr(&H9))
End If
'\v - Vertical tab 0x000B
If s.IndexOf("\v") Then
s = s.Replace("\v", Chr(&HB))
End If
'\\ - Backslash 0x005C
If s.IndexOf("\\") Then
s = s.Replace("\\", Chr(&H5C))
End If
Return s
End Function
Exact number data types that use integer data.
bigint
Integer (whole number) data from -2^63 (-9,223,372,036,854,775,808) through 2^63-1 (9,223,372,036,854,775,807). Storage size is 8 bytes.
int
Integer (whole number) data from -2^31 (-2,147,483,648) through 2^31 - 1 (2,147,483,647). Storage size is 4 bytes. The SQL-92 synonym for int is integer.
smallint
Integer data from -2^15 (-32,768) through 2^15 - 1 (32,767). Storage size is 2 bytes.
tinyint
Integer data from 0 through 255. Storage size is 1 byte.
//+-------------------------------------------------------------
// dateFormat
//+-------------------------------------------------------------
function dateFormat(strDate) {
var ContainsTime = false;
var ContainsDate = true;
var MyDay = null, MyMonth = null, MyYear = null, MyTime = null;
var re = null;
// check for time elements
re = new RegExp("(am|pm|:)", "i");
if (strDate.search(re) != -1) {
ContainsTime = true;
}
// split the parts
re = new RegExp("([/. ]|-)", "i");
var DParts = strDate.split(re);
if (DParts.length == 0) {
return false;
} else if (DParts.length == 1) {
if (ContainsTime == true) {
MyTime = DParts[0];
ContainsDate = false;
} else {
return false;
}
} else if (DParts.length == 2) {
if (ContainsTime == true) {
return false;
} else {
MyDay = DParts[0];
MyMonth = DParts[1];
}
} else if (DParts.length == 3) {
if (ContainsTime == true) {
MyDay = DParts[0];
MyMonth = DParts[1];
MyTime = DParts[2];
} else {
MyDay = DParts[0];
MyMonth = DParts[1];
MyYear = DParts[2];
}
} else if (DParts.length >= 4) {
MyDay = DParts[0];
MyMonth = DParts[1];
MyYear = DParts[2];
if (ContainsTime == true) {
MyTime = DParts[3];
}
}
// put date together if neccessary
if (ContainsDate == true) {
// add year if missing
if (MyYear == null) {
MyYear = (new Date()).getFullYear();
}
// convert Year to number
MyYear = new Number(MyYear);
// make sure year is yyyy
if (MyYear < 100) {
MyYear += MyYear < 40 ? 2000 : 1900;
}
// convert Month string to Month number
if (isNaN(MyMonth)) {
var Months = "janfebmaraprmayjunjulaugsepoctnov";
re = new RegExp(MyMonth, "i");
MyMonth = Months.search(re);
if (MyMonth == -1) {
return false;
}
MyMonth = (MyMonth / 3) + 1;
}
// Validation of month
if ((MyMonth < 1) || (MyMonth > 12)) {
return false;
}
// Validation of day
if (MyDay < 1) {
return false;
}
// Validation leap-year / february / day //
var leap;
if ((MyYear % 4 == 0) || (MyYear % 100 == 0) || (MyYear % 400 == 0)) {
leap = 1;
}
if ((MyMonth == 2) && (leap == 1) && (MyDay > 29)) {
return false;
}
if ((MyMonth == 2) && (leap != 1) && (MyDay > 28)) {
return false;
}
// Validation of other months //
if ((MyDay > 31) && ((MyMonth == 1) || (MyMonth == 3) || (MyMonth == 5) || (MyMonth == 7) || (MyMonth == 8) || (MyMonth == 10) || (MyMonth == 12))) {
return false;
}
if ((MyDay > 30) && ((MyMonth == 4) || (MyMonth == 06) || (MyMonth == 9) || (MyMonth == 11))) {
return false;
}
}
var MyDate = new Date(MyYear, MyMonth, MyDay)
// validate time if neccessary
if (ContainsTime == true) {
re = new RegExp("([0-9]+):?([0-9]*)\s*(am|pm|)", "i");
re.exec(MyTime);
var hour = parseInt(RegExp.$1,10);
var minutes = RegExp.$2;
var ampm = (RegExp.$3).toUpperCase();
if (hour > 12) {ampm = "PM"; hour -= 12;}
MyTime = hour + ":" + ((min == "") ? "00" : minutes);
MyTime += (ampm == "") ? ((hour < 12) ? "AM" : "PM") : ampm;
}
// return formatted string
var RetVal = (ContainsDate == true) ? DateToDateString(MyDate) : "";
RetVal += (ContainsTime == true) ? ((ContainsDate == true) ? " " : "") + MyTime : "";
return RetVal;
}
//+-------------------------------------------------------------
// DateStringToDate
//+-------------------------------------------------------------
function DateStringToDate(DateString)
{
var arrDate, Date1;
arrDate = DateString.split("/");
arrDate[2] = parseInt(arrDate[2]);
if (arrDate[2] < 100)
arrDate[2] += (arrDate[2] < 70) ? 2000 : 1900;
DateString = arrDate[1] + "/" + arrDate[0] + "/" + arrDate[2];
return Date.parse(DateString);
}
//+-------------------------------------------------------------
// DateToDateString
//+-------------------------------------------------------------
function DateToDateString(aDate)
{
return aDate.getDate() + "/" + aDate.getMonth() + "/" + aDate.getFullYear();
}