Web application Sharing including ASP, ASP.NET 1.0 (C#) AND ASP.NET 2.0 (C#) MS SQL 2005 Server, Life, Travelling
Friday, March 27, 2009
Earth Hour
Friday, March 13, 2009
Resize Image in Crystal Report 9 Visual Studio 2005
int LogoWidth = 100;
int LogoHeight = 80;
reportdocument.Load("abc.rpt");
reportdocument.SetDataSource(myDataTable);
reportdocument.Section2.ReportObjects["LogoImage1"].Width = LogoWidth * 15;
reportdocument.Section2.ReportObjects["LogoImage1"].Height = LogoHeight * 15;
CrystalReportViewer.ReportSource = reportdocument;
Sunday, March 1, 2009
JFolder::folder: Path is not a folder - AllVideos Reloaded in Joomla
Sunday, February 15, 2009
Develop application using SQL Compact 3.5 SP1 with Visual Studio 2005
- Install MS SQL Compact 3.5 SP1
- Install MS SQL 2008 Express - to get SQL Server Management Studio to work with SQL Compact for table creation and scripting.
- Add MS SQL Compact 3.5 SP1 engine to VS 2005 project
- Connect to MS SQL Compact 3.5 SP1 engine in VS 2005 (C#) project
- Microsoft .NET Framework 3.5 Service Pack 1
- Windows Installer 4.5
- Windows PowerShell 1.0

string fileName = "mycompactDB.sdf";
string password = "AbCd1@3$5^7*";
string connectionString = string.Format(
"DataSource=\"{0}\"; Password='{1}'", fileName, password);
_connection = new SqlCeConnection(connectionString);
_connection.Open();
Dynamic Image in Crystal Report 9 Visual Studio 2005 - C#
I found many developers facing the same problem as i do - dynamic include image to crystal report with Visual Studio 2005 . This is how we solve our problem in C# when developing a desktop window application.
- In your xsd, create a colomn that does not exist in your dataset, example, [LogoImage], and set the datatype to “System.Byte[]”. You might find the datatype option only have “System.Byte”, you can manually type in “[]”.
- Add the following code in your form.
private void AddImageColumn(DataTable objDataTable, string strFieldName)
{
try
{
DataColumn objDataColumn = new DataColumn(strFieldName,
Type.GetType("System.Byte[]"));
objDataTable.Columns.Add(objDataColumn);
}
catch (Exception ex)
{
//handler
}
}
private void LoadImage(DataRow objDataRow, string strImageField, string FilePath)
{
try
{
FileStream fs = new FileStream(FilePath, System.IO.FileMode.Open,
System.IO.FileAccess.Read);
byte[] Image = new byte[fs.Length];
fs.Read(Image, 0, Convert.ToInt32(fs.Length));
fs.Close();
objDataRow[strImageField] = Image;
}
catch (Exception ex)
{
//Handler
}
} - After your getting your dataset from database and before bind to the report view, do this.
AddImageColumn(myDataTable, "LogoImage");
for (int index = 0; index < myDataTable.Rows.Count; index++)
{
if (myDataTable.Rows[index]["LogoLocation"].ToString() != "")
{
if(File.Exists(myDataTable.Rows[index]["LogoLocation"].ToString()))
{
LoadImage(myDataTable.Rows[index], "LogoImage",
myDataTable.Rows[index]["LogoLocation"].ToString());
}
else
{
LoadImage(myDataTable.Rows[index], "LogoImage",
"C:\\NoImage.jpg");
}
}
else
{
LoadImage(myDataTable.Rows[index], "LogoImage", "C:\\NoImage.jpg");
}
} - Then in your Crystal Report, just drag this column into the report.
Hope this solve your problem.
Monday, February 9, 2009
Installation SQL 2008 Express Error: '' is not a valid login or you do not have permission
To know more on installation guide, please check Install and Configure SQL Server 2008 Express by CondorMan.
I've followed the steps and got error message "'' is not a valid login or you do not have permission." and print screen as below.

I have no idea why is this. I've tried few suggestion stated in some of the forum:
- I've tried to change my user name and try to install.
- Create a new user "sa" with strong password. Login to window using this account and do installation.
Finally, i try to rename my machine/computer name and try to install and the installation completed successfully.

Conclusion:
This may be a bug from microsoft but i'm not sure.
My scenario: computer name = my user account
My Solution: change computer name to != user account then do installation.
p/s: Change user account won't help.
Hope this can help you. Share your solution if you have different one.
Saturday, January 31, 2009
Visual Studio 2005 Crystal Reports deployment
- .NET Framework 2.0 - download from microsoft site
- Project files - compile from Visual Studio 2005
- Crystal reports merge module - discuss here
Here we will discuss how to create crystal reports merge module setup for deployment purposes.
Below are the steps :
- Generate a setup using setup wizard (either create a new project or add a new project to existing project), name it setup1.
- Right click in Setup1, select Add-> Merge Module. and open files listed below (by default, it will go to the correct directory which is C:\Program Files\Common Files\Merge Modules).

Crystal_Database_Access2003.msm
Crystal_Database_Access2003_enu.msm
Crystal_Managed2003.msm
Crystal_regwiz2003.msm
- now right click on Crystal_regwiz2003.msm , Click Properties. in properties window, Click on (MergeModuleProperties), in License Key property set license code of crystal report.
This code can be obtained from Help menu -> About Microsoft Visual Studio, here u find a licence code for 'Crystal Reports'. copy this code and paste it in license key proparty.
Almost done. Now build setup by Right click on Setup1 and Click on Build
- Copy the setup1.exe from you project output folder (normally is in Project's Debug or Release folder)
Install this exe during deployment. Done
More reference:
http://msdn.microsoft.com/en-us/library/ms225227(VS.80).aspx
http://msdn.microsoft.com/en-us/library/aa287924(VS.71).aspx
http://msdn.microsoft.com/en-us/library/aa288179(VS.71).aspx
http://msdn.microsoft.com/en-us/library/ms227409(VS.80).aspx
http://resources.businessobjects.com/support/additional_downloads/runtime.asp
Friday, January 23, 2009
A Happy, Healthy & Properous Year 2009
Sunday, January 11, 2009
DSL 2640T wireless router Save and Reboot
There is an question that always ask by surfer on where can i find [Save and Reboot] button after i have change the port forwarding. There a lots of good article on port forwarding, hence, i wont discuss here. You can get a good one here http://www.portforward.com/english/routers/port_forwarding/Dlink/DSL-2640T/BitComet.htm
My concern here is where to find [Save and Reboot] button after all the setting.Well, it's here
1. Click on Tools
2. Click on System
3. You can find the [Save and Reboot] button.
Done. Hope this help.



