SharePoint / ASP.Net Development
Experiences from the field...
Navigation
   RSS 2.0
Categories
Entries by Month

 Tuesday, August 30, 2005

Sometimes, it seems that the .MDB file will live forever. I recently had to convert some DDL so it would work against the Jet data engine. (Jet does not use ANSI SQL.) In the depths of the MSDN archive was a very useful reference series: Fundamental Microsoft Jet SQL for Access 2000. This page links to two more -- titled Intermediate and Advanced.

Tuesday, August 30, 2005 3:36:08 PM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
 Saturday, August 27, 2005

If you are using active generation of templates, here is a build script that invokes CodeSmith:

<?xml version="1.0" encoding="unicode"?>
<project name="nant" default="compile" xmlns="http://nant.sf.net/schemas/nant.xsd">
 <property name="CodeSmith" value="cs.exe" />

 <target name="compile" depends="genruntime" description="Compile entire solution">
  <solution solutionfile="src\project.sln" configuration="release">
   <webmap>
    <map url="http://localhost/ProjectWeb" path="src\ProjectWeb" />
   </webmap>
  </solution>
 </target>
 <target name="genruntime" description="Generate O/R Classes for the runtime library">
  <exec program="${CodeSmith}" basedir="tools\codesmith" workingdir="src\ProjectWeb.Runtime">
   <arg value="/t: Templates\ClassGenerator.cst" />
   <arg value="/ps: ORClasses.xml" />
  </exec>
 </target>

This script was influenced by Mike Roberts' article How to setup a .NET Development Tree. (Thanks Mike!) I use a property to alias the CodeSmith command (cs.exe) because I kept thinking csc (which compiles C# code).

Saturday, August 27, 2005 11:15:59 AM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
 Tuesday, August 23, 2005

Eli has updated his SharePoint Resources page.  Thank you for a very helpful site.

Tuesday, August 23, 2005 10:25:51 PM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
 Monday, August 22, 2005

Do you have an ASP.Net application that will run in an Application Pool with a specific identity? Before you enter the user account in the Identity tab of the Application Pool properties dialog, you should add the account to the local group IIS_WPG. If you forget, you get permission issues. And permission issues are the hardest to fix, imho.

(I am sure you can guess why I am blogging this...)

Monday, August 22, 2005 11:58:52 AM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
 Thursday, August 18, 2005

While in the process of setting up a WSS site, I couldn't remember how to configure the Announcements list to allow the entry of hyperlinks in the announcement body. I have to admit that I went to Google first. Fortunately, Mike Walsh's FAQ site is at the top of page two!

Thanks Mike!!

Thursday, August 18, 2005 9:31:07 PM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
 Tuesday, August 16, 2005

E. Shupps has started a series of blog posts titled Extreme SharePoint Design Series that promises "advanced tips and tricks for designers."

Tuesday, August 16, 2005 3:37:16 PM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
 Sunday, August 14, 2005

I had to move an extranet application, including the databases, to a new server. The application has just over 300 sites, so of course I had to write code! There is a lot of file copies, but the script does include one interesting piece: creating a database on a server and creating an empty database.

The solution was written in VBScript and runs on a Windows XP machine. The script uses SQL-DMO to perform the database admin steps. I am including the script below as an example.

Now, I am sure that many of you will have an opinion about the code. That is fine. But do not flame about database best practices -- I am simply moving an existing application with specific requirements. And do not flame about the hungarian notation -- VB Script does not have strong typing and the entire script is almost 400 lines. Feel free to flame anything else. ;-)

Sub CreateDB(DBServer, SiteName)
    Dim oDBDataFile, sDataPath, oDBLogFile, sLogPath
    Dim oSvr, oDB

    Set oSvr = CreateObject("SQLDMO.SQLServer")
    oSvr.Connect DBServer, "user", "password" ' Could use WinNT login

    Set oDB = CreateObject("SQLDMO.Database")
    Set oDBDataFile = CreateObject("SQLDMO.DBFile")
    Set oDBLogFile = CreateObject("SQLDMO.LogFile")

    'Set new database name
    oDB.Name = SiteName

    'Define the PRIMARY data file.
    oDBDataFile.Name = SiteName
    sDataPath = oSvr.Registry.SQLDataRoot & "\DATA\" & SiteName & ".mdf"
    oDBDataFile.PhysicalName = sDataPath
    oDBDataFile.PrimaryFile = True
    oDBDataFile.Size = 2 'Set initial size (optional)

    oDBDataFile.FileGrowthType = SQLDMOGrowth_MB 'fixed size - other options available
    oDBDataFile.FileGrowth = 1

    'Add the DBFile object
    oDB.FileGroups("PRIMARY").DBFiles.Add oDBDataFile

    'Define the database transaction log.
    oDBLogFile.Name = SiteName & "Log"
    sLogPath = oSvr.Registry.SQLDataRoot & "\DATA\" & oDBLogFile.Name & ".ldf"
    oDBLogFile.PhysicalName = sLogPath
    oDBLogFile.Size = 2
    oDB.TransactionLog.LogFiles.Add oDBLogFile

    'Create the database as defined.
    oSvr.Databases.Add oDB
    
    'Add a user to the database
    Set oUser = CreateObject("SQLDMO.User")
    oUser.Login = "ExNet"
    oUser.Role = "db_owner" ' Make sure this is appropriate for you!
    oDB.Users.Add(oUser)
    

    ' Now, build the schema from the file of SQL statements
    Const ForReading = 1, ForWriting = 2
    Dim oFSO, oFile, sFile, sCmdBatch
    
    SET oFSO = CreateObject("Scripting.FileSystemObject")

    sFile = "C:\Visual Studio Projects\ExNetMove\CreateDatabase2_05.sql"
    SET oFile = oFSO.OpenTextFile(sFile, ForReading)

    sCmdBatch = oFile.ReadAll
    
    oDB.ExecuteImmediate sCmdBatch, SQLDMOExec_ContinueOnError    

    oFile.Close

End Sub

Sunday, August 14, 2005 11:00:32 PM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
 Thursday, August 11, 2005

Bil Simser has started a project for community-built templates.

Thursday, August 11, 2005 1:26:45 PM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 

I don't have the time for a full review, but the book Building ASP.Net Server Controls by Dale Michalk and Rob Cameron has been very helpful for a long time.

If you are interested in writing server controls (and remember, Web Parts are server controls) this book is for you. The authors start out with very basic "write" statements, but they progress into a sophisticated control -- one that includes templates, CSS styling and data binding.

Thursday, August 11, 2005 12:16:49 AM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
 Wednesday, August 03, 2005
Wednesday, August 03, 2005 10:57:41 AM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
 Tuesday, August 02, 2005

The files referenced in the August Intranet Journal article: Using a Custom Web Page Template for Easy Content Entry

EasyContentEntry.zip (43.6 KB)
Tuesday, August 02, 2005 2:40:36 PM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
Search

Further Reading...

Powered by: newtelligence dasBlog 1.9.7067.0

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008, Paul Schaeflein

Send mail to the author(s) E-mail