The following type characters can be used to force a literal value to be a certain data type
See MSDN for more details
If you are using the PrintPreviewControl and what the page displayed to be refreshed with a new document, you must call the PrintPreviewControl.InvalidatePreview method. In 1.1 this did it automatically everytime a document was set, but now you have to do it manually, thats progress for you!
StatementPrintPreviewControl.Document = aDocument
Below is an example of an Update that has an Inner Join
RebateProcessed = 1
ON TaskEvent.Id = TaskEventAsset.Id
PatientId = @PatientID
JobDate < @PriorTo
ConcentratorId = @ConcentratorId
Found an article that had a nice SQL script to assign execute permissions to a user in SQL2000
Here is the script
DECLARE @sql nvarchar(4000)
DECLARE @db sysname ;
SET @db = DB_NAME()
DECLARE @u sysname ;
SET @u = QUOTENAME('')
SET @sql ='select ''grant exec on ''
+ QUOTENAME(ROUTINE_SCHEMA) + ''.''
+ QUOTENAME(ROUTINE_NAME) + '' TO ' + @u
+ ''' FROM INFORMATION_SCHEMA.ROUTINES ' +
'WHERE OBJECTPROPERTY(OBJECT_ID(ROUTINE_NAME),''IsMSShipped'') = 0'
EXEC master.dbo.xp_execresultset @sql,@db
When the CreatedUser event is fired and the LoginCreatedUser is set to true, the new user is only logged in once the event is completed! To get the new user information use the following code…
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
TextBox serialNumberTextBox =
SerialNumber serial = new SerialNumber(serialNumberTextBox.Text);
serial.UserId = Membership.GetUser(CreateUserWizard1.UserName).ProviderUserKey.ToString();
serial.DateRegistered = DateTime.Now;
I can’t find anyway of using the ErrorMessage that is part of the CreateUserWizard. I can FindControl OK and set the values, but when it is rendered to the page its blank. Had to resort to adding my own literal to the page so that I can see my errors.
When supplying null values to stored procedures, remember that you have to set the value to DBNull…
if (_UserId == null)
cmd.Parameters.Add(new SqlParameter("@UserId",System.DBNull.Value ));
cmd.Parameters.Add(new SqlParameter("@UserId", _UserId));
Add the following line to ensure the user is prompted to download a file
Response.AddHeader "content-disposition","attachment; filename=fname.ext"
To configure an existing site to use ASP.Net Membership, but storing the data in the site database rather than creating an MDF in the APP_Data folder.
Run the utility c:\windows\microsoft.net\framework\v2.0.50727\aspnet_regsql
Follow the wizard to connect to the relevant server/database, this will need to be repeated for both test and production.
In the <system.web> section of the web.config ensure that an entry as below is included…
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
In the <connectionStrings> section add the appropriate connection string with a key of “SecurityConenction”
While editing the site within VS2005, from the WebSite menu selecti ASP.Net Configuration. This will open a web page that allows you to create users and rules for the application. Rules that are defined are stored in the Web.Config, so do this for the development site only, as you won’t have access to the live config file. Any folders with restricted access will also have a web.config file created in them, these will need to be promoted to live.
To release to production, change your security connection to point to the production database, set up the relevant users, but not the rules. Then when promoting code to production manually update the root config with the required authorisation, membership and connection strings, that can be taken from the development config file.
In VB.Net Framework V2.0 a new command was introduced called TryCast It works the same as DirectCast but if the cast fails instead of throwing an exception the object is set to Nothing
Take a look at MSDN for more details.