Thursday, September 18, 2008
System.UnauthorizedAccessException: Access to the path "e:\Inetpub\wwwwroot11\Project\Dumpfile.xls" is denied
Solution:
1.) Go the specific folder that contains the file
2.)Right-click the folder and click Properties
3.) Go to Security tab then look for Network Service user. Modify permissions within the folder .
4.)Lastly, Click OK
Thursday, August 21, 2008
C# - Split Sample
string _approvers = "allan;che;paul";
char[] delimiterChars = { ';' };
string[] arrVar = _approvers.Split(delimiterChars);
for(int x = 0; x < arrVar.Length; x++)
{
Response.Write(arrVar [x] );
}
Wednesday, July 30, 2008
Export Data List to Excel
Response.Clear();
Response.Buffer= true;
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
this.EnableViewState = false;System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.ClearControls(DataGridView);DataGridView.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.Flush();
Response.End();
Response.Buffer= true;
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
this.EnableViewState = false;System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.ClearControls(DataGridView);DataGridView.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.Flush();
Response.End();
Tuesday, June 3, 2008
SQL Joins
Joins
Syntax:
SELECT field1, field2, field3 FROM firsttable
INNER JOIN secondtable
ON firsttable.keyfield = secondtable.foreign_keyfield
Example:
SELECT Purchase.Name, Orders.Product FROM Purchase
INNER JOIN Orders
ON Purchase.PurchaseID=Orders.PurchaseID
Left Join
syntax:
SELECT field1, field2, field3 FROM firsttable
LEFT JOIN secondtable
ON firsttable.keyfield = secondtable.foreign_keyfield
Example
SELECT Purchase.Name, Orders.Product
FROM Purchase LEFT JOIN Orders
ON Purchase.PurchaseID=Orders.PurchaseID
Left Join- returns all the rows from the first table (Purchase), even if there are no matches in the second table (Orders). If there are rows in Employees that do not have matches in Orders, those rows also will be listed.
RIGHT JOIN
syntax
SELECT field1, field2, field3
FROM firsttable
RIGHT JOIN secondtable
ON firsttable.keyfield = secondtable.foreign_keyfield
Example
SELECT Purchase.Name, Orders.Product
FROM Purchase
RIGHT JOIN Orders
ON Purchase.PurchaseID=Orders.Purchase
Syntax:
SELECT field1, field2, field3 FROM firsttable
INNER JOIN secondtable
ON firsttable.keyfield = secondtable.foreign_keyfield
Example:
SELECT Purchase.Name, Orders.Product FROM Purchase
INNER JOIN Orders
ON Purchase.PurchaseID=Orders.PurchaseID
Left Join
syntax:
SELECT field1, field2, field3 FROM firsttable
LEFT JOIN secondtable
ON firsttable.keyfield = secondtable.foreign_keyfield
Example
SELECT Purchase.Name, Orders.Product
FROM Purchase LEFT JOIN Orders
ON Purchase.PurchaseID=Orders.PurchaseID
Left Join- returns all the rows from the first table (Purchase), even if there are no matches in the second table (Orders). If there are rows in Employees that do not have matches in Orders, those rows also will be listed.
RIGHT JOIN
syntax
SELECT field1, field2, field3
FROM firsttable
RIGHT JOIN secondtable
ON firsttable.keyfield = secondtable.foreign_keyfield
Example
SELECT Purchase.Name, Orders.Product
FROM Purchase
RIGHT JOIN Orders
ON Purchase.PurchaseID=Orders.Purchase
Tuesday, April 29, 2008
Error 1 The type or namespace name 'ConfigurationManager' does not exist
The most likely this issue is a missing a reference to the System.Configuration.dll. I had the issue about this when i was working on my Data Access Layer in my project. Eventhough i have declared the "using System.Configuration" namespace. it still didnt work. So i decided to do an Add reference to the System.Configuration.dll at my Class Library Data Access Layer project, then it worked. Hope this helps
Thursday, April 10, 2008
SQL Data Statements
Select Statements
Select fieldname , fieldname From table name
example: Select DistributorID , DistributorName From DistributorTable
Update Statements
UPDATE table name
Set fieldname = value
example:
Update Customers
Set Name = 'Jerry'
Delete Statements
Delete From tablename
example:
Delete From Customers
Select fieldname , fieldname From table name
example: Select DistributorID , DistributorName From DistributorTable
Update Statements
UPDATE table name
Set fieldname = value
example:
Update Customers
Set Name = 'Jerry'
Delete Statements
Delete From tablename
example:
Delete From Customers
Friday, April 4, 2008
Connection Strings
SQL Connection String
Data Source=ServerName;Initial Catalog=DatabaseName;Persist Security Info=True;User ID=username;Password=password;
OLEDB Connection String
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=username;Password=password;
Oracle Connection String
Provider=msdaora;Data Source=MyOracleDataBase;User Id=myUsername;Password=myPassword;
Data Source=ServerName
OLEDB Connection String
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=username;Password=password;
Oracle Connection String
Provider=msdaora;Data Source=MyOracleDataBase;User Id=myUsername;Password=myPassword;
Subscribe to:
Posts (Atom)