Thursday, February 9, 2012

The ‘Microsoft.ACE.OLEDB.12.0′ provider is not registered on the local machine

Back a few years ago, before Microsoft Office 2010, life was a little easier for developers: Office was 32-bit, period.

As you know our days just got a little more complicated since that with Microsoft Office 2010, users can also install a 64-bit native version of Office as well.

This means to us developers that our 32-bit applications using an OLEDB Provider to access Excel or Access files might not work anymore since the 32-bit provider might not exist on a 64-bit Office 2010 installation.

In such cases, even though the user has a valid installation of Microsoft Office 2010 installed on his machine, your application might get an error as:

The ‘Microsoft.ACE.OLEDB.12.0′ provider is not registered on the local machine.

Well to address such problems Microsoft released a new redistributable named the “Microsoft Access Database Engine 2010 Redistributable”. This redistributable provides a 32-bit or a 64-bit version of the Microsoft ACE OLEDB Provider which can be downloaded here:

http://www.microsoft.com/downloads/en/details.aspx?familyid=C06B8369-60DD-4B64-A44B-84B371EDE16D&displaylang=en

So if as a developer you have a 32-bit application using this OLEDB provider on a machine with a 64-bit installation of Office 2010 (such as the CodeFluent Entities Access Importer), you’ll need to install the 32-bit version of the provider.

Install Tip

Launching the install of a Microsoft ACE OLEDB Provider on a machine with an Office install other than the current one (e.g. 32 on 64) will cause the install to fail. To have it run properly you need to launch it from a command line with the “/passive” argument specified.

To install the Microsoft ACE OLEDB Provider 32-bit on a machine running Office 2010 64-bit:

$> AccessDatabaseEngine.exe /passive

To install the Microsoft ACE OLEDB Provider 64-bit on a machine running Office 2010 32-bit:

$> AccessDatabaseEngine_X64.exe /passive

REF:http://blog.codefluententities.com/2011/01/20/microsoft-access-database-engine-2010-redistributable/

Wednesday, August 18, 2010

UltraWebGrid Check All/UnCheck ALL

function iggrdGridKitMgmt_ColumnHeaderClickHandler(gridName, columnId, button)
{
// debugger;
var myCol = igtbl_getColumnById(columnId);
var myGrid = igtbl_getGridById(gridName);

if(myCol.Key != "ChkAll" && myCol.Key != "Uncheck All")
{

return;
}
if (myCol.Key == "ChkAll")
{


for (i = 0; i < myGrid.Rows.length; i++)
{

myGrid.Rows.getRow(i).getCellFromKey("ChkAll").setValue(1);

}
myCol.Key = "Uncheck All";
myCol.HeaderText= "Uncheck All";
}
else
{
for (i = 0; i < myGrid.Rows.length; i++)
{


myGrid.Rows.getRow(i).getCellFromKey("Uncheck All").setValue(0);

}
myCol.Key = "ChkAll";
myCol.HeaderText = "Check All";
}
}
//If template Column and inside we have check box
function iggrdGridKitMgmt_ColumnHeaderClickHandler(gridName, columnId, button)
{
//debugger;



var myCol = igtbl_getColumnById(columnId);
var myGrid = igtbl_getGridById(gridName);

if(myCol.Key != "ChkAll" && myCol.Key != "UncheckAll")
{

return false ;
}
if (myCol.Key == "ChkAll")
{


for (i = 0; i < myGrid.Rows.length; i++)
{
myGrid.Rows.getRow(i).getCellFromKey("ChkAll").getElement('chkSelect').all[0].checked=true;
}
myCol.Key = "UncheckAll";
myCol.HeaderText= "Uncheck All";
}
else
{
for (i = 0; i < myGrid.Rows.length; i++)
{
myGrid.Rows.getRow(i).getCellFromKey("UncheckAll").getElement('chkSelect').all[0].checked=false;
myGrid.Rows.getRow(i).getCellFromKey("UncheckAll").Column.Selected = false ;
}
myCol.Key = "ChkAll";
myCol.HeaderText = "Check All";
}
return false ;
}

Thursday, June 17, 2010

DataTable to CSV

private void exportDataTableToCsv(DataTable formattedDataTable, string filename)
{
DataTable toExcel = formattedDataTable.Copy();
HttpContext context = HttpContext.Current;
context.Response.Clear();

foreach (DataColumn column in toExcel.Columns)
{
context.Response.Write(column.ColumnName + ",");
}

context.Response.Write(Environment.NewLine);
foreach (DataRow row in toExcel.Rows)
{
for (int i = 0; i < toExcel.Columns.Count; i++)
{
context.Response.Write(row[i].ToString().Replace(",", string.Empty) + ",");
}

context.Response.Write(Environment.NewLine);
}

context.Response.ContentType = "text/csv";
context.Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename + ".csv");
context.Response.End();
}

Wednesday, June 2, 2010

Apply Styles for row - GridView

protected void grdTemp_RowDataBound(object sender, GridViewRowEventArgs e)
{

//Apply Styles for Header
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[17].Text == "RepeatHeader")
{
e.Row.BackColor = System.Drawing.Color.FromName("#003366");
e.Row.ForeColor = System.Drawing.Color.White;

}
}

Tuesday, June 1, 2010

Format Currency

double dblAmt;
string curCulture = System.Threading.Thread.CurrentThread.CurrentCulture.ToString();
System.Globalization.NumberFormatInfo currencyFormat = new System.Globalization.CultureInfo(curCulture).NumberFormat;
currencyFormat.CurrencyNegativePattern = 1;

if (dsCash.Tables[0].Rows[0]["Amount"].ToString().Trim() != "")

{
dblAmt = Convert.ToDouble(dsCash.Tables[0].Rows[0]["Amount"].ToString());
lblCashAlternatives.Text = dblAmt.ToString("c", currencyFormat);
}
else
{
lblCashAlternatives.Text = "$0.0";
}