Monthly Archives: May 2008

ProfileCommon could not be found

Ran into this little one today, when trying to specify additional properties in an ASP.net profile. I had the following in my web.config file for testing before adding additional properties.

 

<profile
enabled=“true“>

<properties>

</properties>

</profile>

I was then getting a missing reference error when i tried to do;

 

ProfileCommon p = (ProfileCommon) ProfileCommon.Create(CreateUserWizard1.UserName, true);

 

The problem is that ProfileCommon is a generated class, compiled only after you insert the <profile> section into your web.config file. However, the class is only compiled if you specify and additional property in the properties section, if you do not then the class is not compiled. The correct entry for web.config is;

<profile
enabled=“true“>

<properties>

<add
name=“dob“
type=“string“/>

</properties>

</profile>

Check out http://msdn.microsoft.com/en-us/library/ms998317.aspx and http://weblogs.asp.net/scottgu/archive/2005/10/18/427754.aspx for more info on forms authentication and asp.net profiles.

Advertisements

Importing or linking an Access 2007 db to a SQL Server 2005 database over a network

  1. First make sure the database is setup to use SQL auth as above (note NT auth will work also but requires client to use user name and password of server)
  2. In access create a new db and import data from an ODBC db
  3. Create a “Machine DSN” not a FILE DSN (File DSN is the default) see http://support.microsoft.com/kb/327268
  4. Select the tables you want to import or link to
  5. If access cannot identify a key field in the tables it will offer you the opportunity to create one (not necessary)
  6. Note foreign key relationships between tables will not be imported and must be manually re-entered, but can be saved without affecting the SQL server if using linked tables (good news is the relationships remain even after a refresh of the linked tables)

(a tip if you want to use linked table so that users can see up to the minute data without having to import but don’t want the users to modify the underlying SQL server db then when creating the SQL server login about and applying user mapping, choose to only allow the user to read the specific database and not to have write privileges)

Access 2007 – reports and sub reports

Got this error when trying to place a sub report in a main report “Error: the expression is typed incorrectly or it is too complex to be evaluated” This only occurred when trying to create a sub report, sub report works on its own fine but when launched within the main report the above error pops up multiple times.

Identified by a process of elimination that there was a field in the table on which the sub report was based which had the same name as a field in the table on which the main report was based.

Further this common field name was being used as the key field to create the parent child relationship; the error is thus probably due to a naming conflict.

The solution is to rename the conflicting field in the sub report, by editing the SQL statement for the sub report and replacing the conflicting field name with table.conflictname as newnonconflcitingname

e.g. select field1, field2, field3 as myfield3, field4 from table (Note in this example field3 is the conflicting field)

%d bloggers like this: