Thursday, May 19, 2011

Play a video file in HTML

<object classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' id='player' width='150'
height='150' standby='Please wait while the object is loaded...'>
<param name='url' value='D:\Experiments\clock.avi' />
<param name='src' value='D:\Experiments\clock.avi' />
<param name='AutoStart' value='false' />
<param name='Balance' value='0' /> //-100 is fully left, 100 is fully right.
<param name='CurrentPosition' value='0' /> //Position in seconds when starting.
<param name='showcontrols' value='true' /> //Show play/stop/pause controls.
<param name='enablecontextmenu' value='true' /> //Allow right-click.
<param name='fullscreen' value='true' /> //Start in full screen or not.
<param name='mute' value='false' />
<param name='PlayCount' value='1' /> //Number of times the content will play.
<param name='rate' value='1.0' /> //0.5=Slow, 1.0=Normal, 2.0=Fast
<param name='uimode' value='custom' /> // full, mini, custom, none, invisible
<param name='showdisplay' value='false' /> //Show or hide the name of the file.
<param name='volume' value='50' /> // 0=lowest, 100=highest

Tuesday, May 10, 2011

SQL Bulk Copy

SQL Bulk Copy is for moving data from one Table to another. This can be from a single server or between different servers (Source and destination are different servers).
SqlBulk copy class can be used to write data only to sql server tables. Any data source can be used for loading data as long as the data can be loaded to a Data Table or read with an IDataReader instance.
In The example mentioned below, I am using Oracle Table as source and Sql Server Table as destination. Also DataReader is using to fetch data from oracle.

SQL Bulk Copy Example

public void BulkCopyMethod()
string oracleConnectionString = "Data Source=SERVICENAME;User Id=USERNAME;Password=PASSWORD;";
string sqlConnectionString = "Data Source=DATASOURCE;Initial Catalog=DATABASENAME;Connect Timeout=0;User ID=USERNAME;Pwd=PASSWORD;";
string oracleSelectStatement = "SELECT EmployeeID,EmployeeName,EmployeeAge,EmployeePlace,EmployeePin,EmployeePhoneNum FROM EmployeeData";

using (OracleConnection oracleConn = new OracleConnection(oracleConnectionString))
OracleCommand employeeCommand = new OracleCommand(oracleSelectStatement, oracleConn);
OracleDataReader employeeReader = employeeCommand.ExecuteReader();

using (SqlBulkCopy bulkCopy = new SqlBulkCopy(sqlConnectionString))
bulkCopy.DestinationTableName = "dbo.tblEmployee";
bulkCopy.ColumnMappings.Add("EmployeeID", "Id");
bulkCopy.ColumnMappings.Add("EmployeeName", "Emp_Name");
bulkCopy.ColumnMappings.Add("EmployeeAge", "Emp_Age");
bulkCopy.ColumnMappings.Add("EmployeePlace", "Emp_Place");
bulkCopy.ColumnMappings.Add("EmployeePin", "Emp_Pin");
bulkCopy.ColumnMappings.Add("EmployeePhoneNum", "Emp_Phone");

catch (Exception ex)
throw ex;

For more info:-