标签:tab ice inf catalog init sel ble spl sql
//字段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();// 关闭数据库连接
标签:tab ice inf catalog init sel ble spl sql
原文地址:https://www.cnblogs.com/ganbei/p/11274548.html