//字段ArticleID,ArticleName,ArticleNumber,Unit,Weight,Price,Currency,IsIuggage,IsQuarantine
string str = myArticleInfo[i].ArticleID.ToString();//取物品編碼進行查詢
string strconn = "Data Source=192.168.100.132;Initial Catalog=CustomsPlatform;User ID=sa;password=max_123456"; //鏈接語句
SqlConnection conn = new SqlConnection(strconn); ////連接到引入的數據庫
conn.Open();// 打開數據庫連接
SqlCommand sqlcmd = new SqlCommand();//創建 Command 對象
sqlcmd.CommandText = string.Format(@"select ArticleID,ArticleName,ArticleNumber,Unit,Weight,Price,Currency,IsIuggage,IsQuarantine
from [CustomsPlatform].[dbo].[TB_ArticleInfo] where ArticleID = '{0}'", str);//執行查詢語句
sqlcmd.Connection = conn;
SqlDataAdapter adp = new SqlDataAdapter(sqlcmd);
DataTable dt = new System.Data.DataTable();
adp.Fill(dt);
this.SortListViewData.DataSource = dt;
conn.Close();// 關閉數據庫連接