Sep 22, 2010
Sep 4, 2010
Check And Upgrade Existing Database
How to change database schema, adding or deleting field or table, to be sure of new version of application will work correctly and existing users not lose their data?
You working on application and have customers. One wonderful day customer ask you for new functionality. But you see it need to change database scheme. You made local changes, but many customers have old database. How to upgrade existing database, not harming to customers data. Make migration script and copy data from old database to new one? Not so good way.
What about programmatically change database schema on fly? For example you have table 'customers' and need to add field 'mob_phone'; You can use SQL statement to add field, only need to care if database schema already up to date.
You working on application and have customers. One wonderful day customer ask you for new functionality. But you see it need to change database scheme. You made local changes, but many customers have old database. How to upgrade existing database, not harming to customers data. Make migration script and copy data from old database to new one? Not so good way.
What about programmatically change database schema on fly? For example you have table 'customers' and need to add field 'mob_phone'; You can use SQL statement to add field, only need to care if database schema already up to date.
Labels:
add field,
ADO.NET,
ALTER TABLE,
change database,
example,
schema,
SQL,
SQL CE,
upgrade database
Sep 2, 2010
Enumerate Embedded Resource Names
How to know and enumerate names of all resources, embedded into assembly?
Well, we know how to load embedded font to memory from resources, but... stream, returned from GetManifestResourceStream is always null??
Ok, you have to be sure about resource name. In general resource name consists from {assembly namespace}.{folder}.{file name}. If your resource not in folder at solution space than it simply {assembly namespace}.{file name}. And at last property of file should be "Embedded Resource".
Well, we know how to load embedded font to memory from resources, but... stream, returned from GetManifestResourceStream is always null??
Ok, you have to be sure about resource name. In general resource name consists from {assembly namespace}.{folder}.{file name}. If your resource not in folder at solution space than it simply {assembly namespace}.{file name}. And at last property of file should be "Embedded Resource".
Sep 1, 2010
Embedding Font To Resources
How to load and use custom font, embedded in assembly resources.
We leared how to load font not installed in system. But what about embedding font into assembly resources? We will use PrivateFontCollection as in previous example private font loading. But we'll need little bit more action.
First we add font file into project. Place it in root folder of project. Go to property and choose action Embedded Resource for font file.
Next add code to read font from resource.
We leared how to load font not installed in system. But what about embedding font into assembly resources? We will use PrivateFontCollection as in previous example private font loading. But we'll need little bit more action.
First we add font file into project. Place it in root folder of project. Go to property and choose action Embedded Resource for font file.
Next add code to read font from resource.
Labels:
.net,
AddMemoryFont,
C#,
CodeProject,
Embedding,
font,
GDI,
GDI+,
graphics,
PrivateFontCollection,
programming,
Resource,
WinForms
Subscribe to:
Posts (Atom)