DataRow drBlank = dsList.Tables[0].NewRow();
drBlank["IsLabelPrinted"] = 0;
drBlank["GroupID"] = -1;
dsList.Tables[0].Rows.Add(drBlank);
dsList.AcceptChanges();
Tuesday, September 8, 2009
IP address regex
///
/// Validate that String is an IP address.
/// Between 0.0.0.0 and 255.255.255.255
///
protected Regex regIP = new Regex(
@"(?2[0-4]\d|25[0-5]|[01]?\d\d?)\.(?2[0-4]\d|25"
+ @"[0-5]|[01]?\d\d?)\.(?2[0-4]\d|25[0-5]|[01]?\d\d?)\.(?"
+ @"2[0-4]\d|25[0-5]|[01]?\d\d?)",
RegexOptions.IgnoreCase
| RegexOptions.CultureInvariant
| RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
/// Validate that String is an IP address.
/// Between 0.0.0.0 and 255.255.255.255
///
protected Regex regIP = new Regex(
@"(?
+ @"[0-5]|[01]?\d\d?)\.(?
+ @"
RegexOptions.IgnoreCase
| RegexOptions.CultureInvariant
| RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
Wednesday, August 19, 2009
Data source name not found and no default driver specified
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
I had this error and want to let you know how it was resolved.
First, this was an ASP web application using a vb 6.0 dll to get data from a sql server 2005 database on a 64 bit windows server 2008 enterprise (vista like) server. I could only get the dll to work in component services as opposed to simply registering it.
It all worked fine upon setup, but after four windows updates one night, the error above was posted in the event viewer, and the web app crashed.
Here is the resolution:
In a 64 bit windows server operating system, there are TWO odbc managers. When you pull up the usual menu for the odbc / dsn system, it is for the 64 bit odbc manager, and 32 bit applications (vb 6.0) will not work using these dsn's.
This is where the 32 bit odbc manager is:
C:\Windows\SysWOW64\odbcad32.exe
I hope you do not have to go through what I and three Microsoft Support engineers had to to figure this out.
Jonathan
I had this error and want to let you know how it was resolved.
First, this was an ASP web application using a vb 6.0 dll to get data from a sql server 2005 database on a 64 bit windows server 2008 enterprise (vista like) server. I could only get the dll to work in component services as opposed to simply registering it.
It all worked fine upon setup, but after four windows updates one night, the error above was posted in the event viewer, and the web app crashed.
Here is the resolution:
In a 64 bit windows server operating system, there are TWO odbc managers. When you pull up the usual menu for the odbc / dsn system, it is for the 64 bit odbc manager, and 32 bit applications (vb 6.0) will not work using these dsn's.
This is where the 32 bit odbc manager is:
C:\Windows\SysWOW64\odbcad32.exe
I hope you do not have to go through what I and three Microsoft Support engineers had to to figure this out.
Jonathan
Monday, August 10, 2009
drop all constraints on a table
-- t-sql scriptlet to drop all constraints on a table
DECLARE @database nvarchar(50)
DECLARE @table nvarchar(50)
set @database = 'dotnetnuke'
set @table = 'tabs'
DECLARE @sql nvarchar(255)
WHILE EXISTS(select * from INFORMATION_SCHEMA.TABLE_CONSTRAINTS where constraint_catalog = @database and table_name = @table)
BEGIN
select @sql = 'ALTER TABLE ' + @table + ' DROP CONSTRAINT ' + CONSTRAINT_NAME
from INFORMATION_SCHEMA.TABLE_CONSTRAINTS
where constraint_catalog = @database and
table_name = @table
exec sp_executesql @sql
END
DECLARE @database nvarchar(50)
DECLARE @table nvarchar(50)
set @database = 'dotnetnuke'
set @table = 'tabs'
DECLARE @sql nvarchar(255)
WHILE EXISTS(select * from INFORMATION_SCHEMA.TABLE_CONSTRAINTS where constraint_catalog = @database and table_name = @table)
BEGIN
select @sql = 'ALTER TABLE ' + @table + ' DROP CONSTRAINT ' + CONSTRAINT_NAME
from INFORMATION_SCHEMA.TABLE_CONSTRAINTS
where constraint_catalog = @database and
table_name = @table
exec sp_executesql @sql
END
Wednesday, July 22, 2009
Wednesday, July 15, 2009
PageMethods
PageMethods.Echo('Hello World!', onComplete, onTimeout, onError, onAbort, context, timeout, priority);
First of all, we must pass all the arguments that the page method is accepting, separated by a comma; in this case, the Echo method accepts one argument, the string to echo. After the list of the server method's arguments, we can pass the references to three methods to call when the page method returns:
•onComplete, is a function that will be called if the page method returns with no errors.
•onTimeout, will be called if the page method doesn't return a value within the specified timeout interval.
•onError, will be invoked if an error occurs during the process of the asynchronous request (for example, an Exception being raised on server-side).
•onAbort, is invoked when the asynchronous request is aborted. This can be done by calling the abort() method on the WebRequest object returned with the call to PageMethods.Echo().
•context, is the state object that will be passed to the callbacks when processing results.
•timeout, specifies the timeout before an asynchronous request is dropped. A response must arrive before the timeout occurs.
•priority, is a number that specifies the priority of the asynchronous request.
First of all, we must pass all the arguments that the page method is accepting, separated by a comma; in this case, the Echo method accepts one argument, the string to echo. After the list of the server method's arguments, we can pass the references to three methods to call when the page method returns:
•onComplete, is a function that will be called if the page method returns with no errors.
•onTimeout, will be called if the page method doesn't return a value within the specified timeout interval.
•onError, will be invoked if an error occurs during the process of the asynchronous request (for example, an Exception being raised on server-side).
•onAbort, is invoked when the asynchronous request is aborted. This can be done by calling the abort() method on the WebRequest object returned with the call to PageMethods.Echo().
•context, is the state object that will be passed to the callbacks when processing results.
•timeout, specifies the timeout before an asynchronous request is dropped. A response must arrive before the timeout occurs.
•priority, is a number that specifies the priority of the asynchronous request.
Subscribe to:
Posts (Atom)