https://www.mytecbits.com/microsoft/sql-server/auto-generate-insert-statements
Monday, June 6, 2022
SQL Copy one table records to another table - INSERT RECORD FROM ONE TABLE TO ANOTHER - COPY TABLE
INSERT INTO newTable
SELECT * FROM oldTable
For single column
INSERT INTO orders(customer_id)
SELECT customer_id FROM Customers
https://stackoverflow.com/questions/13237623/copy-data-into-another-table
Grid View export to Excel ASP.NET C# with hiding of columns
protected void ExportToExcel(object sender, EventArgs e)
{
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=CourseList.xls");
Response.Charset = "";
Response.ContentType = "application/vnd.ms-excel";
using (StringWriter sw = new StringWriter())
Thursday, June 2, 2022
Grid view paging or without paging with serial number counting in ASP.NET C#
With Paging
ASPX page
<asp:GridView ID="GridInvoice" OnPageIndexChanging="GridInvoice_PageIndexChanging">
<Columns>
<asp:TemplateField HeaderText="S.No." ItemStyle-Width="20">
<ItemTemplate>
<%#(grdCourseDetails.PageSize * grdCourseDetails.PageIndex) + (Container.DisplayIndex + 1)%>
</ItemTemplate>
</columns>
</asp:gridview>
aspx.CS file
protected void grdCourseDetails_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
grdCourseDetails.PageIndex = e.NewPageIndex;
GetCourseDetailsWithPaging(Convert.ToInt16(Lbl_Course_Div_Status.Text), e.NewPageIndex, 10);
}
Without Paging
ASPX page
<asp:GridView ID="GridInvoice" >
<Columns>
<asp:TemplateField HeaderText="S.No." ItemStyle-Width="20">
<ItemTemplate>
<%#(Container.DataItemIndex + 1)%>
</ItemTemplate>
</columns>
</asp:gridview>
The wait operation timed out C# ASP.NET commandtimeout - How to execute long time queries - maximum file upload file size in web.config
if you are getting error :- System.ComponentModel.Win32Exception: The wait operation timed out
//default to 30seconds
dataadapter.SelectCommand.COmmandTimeOut = 180;
or set it to 0, it will act as infinity
or
<connectionStrings>
add name="mConnectionString" connectionString="Server=DESKTOP-EUCFT2Q; Database=ESDM_NIELIT_NEW; UID=sa; PWD=25032022; Connection Timeout = 2; Min Pool Size=20; Max Pool Size=200" providerName="System.Data.SqlClient"/>
</connectionStrings>