Monday, 29 October 2018

Too many fields defined excel import get data

///////////////
Error

too many fields defined


Case-
The internal column count that Microsoft Access uses to track the number of fields in the table has reached 255, even though you may have fewer than 255 fields in the table. This can happen because Access does not change the internal column count when you delete a field. Access also creates a new field (increasing the internal column count by 1) for every field whose properties you modify.

////////////Solution

Where////////////// A1:R51 Sheet range , selected by columns

using (OleDbDataAdapter oda = new OleDbDataAdapter("SELECT * FROM Shee$A1:R51]", excel_con))
{
  oda.Fill(dt);

 }

copy excel sheet name to cell

///////////////////


Select a blank cell, copy and paste the formula =MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)


Tuesday, 23 October 2018

Select Insert into table from another table using sql server

/////////// Sql Query


------------------------- Insert table to table all data
SELECT * INTO newTableName FROM oldTableName WHERE Condition;

------------------------- Insert table to table selected columns
SELECT s.CustomerName, s.OrderID INTO CustomersOrderBackup2017 FROM Customers s LEFT JOIN Orders o ON o.CustomerID = s.CustomerID

------------------------- Insert table to table selected columns with conditions
SELECT s.CustomerName, s.OrderID INTO CustomersOrderBackup2017 FROM Customers s LEFT JOIN Orders o ON o.CustomerID = s.CustomerID WHERE Condition;


How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...