To import data from excel to DB
Here,I introduce some methods to import data from excel to DB, 1 By OPENDATASOURCESELECT * FROM OPENDATASOURCE( 'Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;D...
To create user and maintain authorization
SAP authorization control systemTo create user1 Input T-code SU01, and then enter, and then input user name and click CREATE or F8 to create it2 Input necessary information as below3 ...
To create new Datatable
To create new Datatable: private DataTable getTable(string client, string shipment, DataTable d) { &...
Select all and Unselect all for ListView
Select all and Unselect all for ListView: private void btnSelect_Click(object sender, EventArgs e) { &nbs...
Useful Functions(2)
MessageBox.showif (MessageBox.Show(null, "Do You Want to Delete :" + LV.Items[i].SubItems[8].Text.Trim() + "' data?", "Alter", MessageBoxButtons.YesNo) == DialogResult.Yes){} MessageBox.Show("Success!...
To get text when ListView or GridView index changed
To get text when ListView or DataGrid index changed: private void LV_SelectedIndexChanged(object sender, EventArgs e)  ...
To add header and data for ListView
To add header and data for ListView: LV.Columns.Clear(); ...
check all items
Select all and Unselect all for GridView:Background:protected void btnSelectAll_Click(object sender, EventArgs e){ if (btnSelectAll.T...
To create ItemTemplate
To create ItemTemplate and get its value: <asp:GridView ID="gvShipment" runat="server" BackColor="White" Bord...
ASPNET's useful function(2)
1 To create new page when many rows or data to be showed: protected void btnQuery_Click(object sender, EventArgs e) &n...
ASPNET's useful function(1)
1 To add attribute to a button in Page_Load: protected void Page_Load(object sender, EventArgs e) &nb...
Upload weight
How to get the true weight after goods was placed on a scale? private void Mscom_Initial() { ...
To print label
To print label with the control named AxInterop.MSCommLib,Interop.MSCommLibinitial comm port try &n...
SQLHelper
SQLHelper offers some common function to operate DBusing System.Configuration;using System.Data;using System.Data.SqlClient; public class SQLHelper { &nb...
Useful Functions(1)
How to catch UserName and Version? How to play audio file from special folder? You can benefit from blow code.To get user's IDof current computerusing System.Security.Principal;WindowsPrinci...
Common function of Read-write file
We often read or write a file(.txt, .xls etc.), and we can achieve it through following common class.using System;using System.Collections.Generic;using System.Text;using System.Data;using System.IO;u...
How to send mail automatically
Sometimes, it's convenient to do some tasks through background job. In other words, through Scheduled Tasks. If you really do so, it's difficult to know whether the job executed successfully. However,...
How to get the length of a string
If the length of an English character is 1, and Chinese character is 2, how to get the length of a string including English or Chinese character or both? The following methods may help you.Method 1:i...
How to catch SQL Statement's information quickly
You can fetch all information about SQL Statement with below SQL scirpt. Then you can analyze and improve script to boost performance.SELECT creation_time,last_execution_time,total_physica...