标签:
获取DataTable
DataTable dtTable = null; using (SqlConnection connSelect = new SqlConnection(_connFirst)) { try { connSelect.Open(); string strSql = "select BarcodeCompInfo.*,WorkOrder.ContractID from BarcodeCompInfo left join WorkOrder on BarcodeCompInfo.WorkOrderID=WorkOrder.WorkOrderID where BarcodeCompInfo.AID>=" + begin + " and BarcodeCompInfo.AID<" + end; SqlDataAdapter myDp = new SqlDataAdapter(strSql, connSelect); DataSet ds = new DataSet(); myDp.Fill(ds); connSelect.Close(); dtTable = ds.Tables[0]; } catch { } }
插入
using (SqlConnection connInsert = new SqlConnection(_connSecond)) { connInsert.Open(); SqlCommand command = new SqlCommand(strSql, connInsert); command.CommandType = CommandType.Text; command.ExecuteNonQuery(); connInsert.Close(); }
标签:
原文地址:http://www.cnblogs.com/zhongxinWang/p/4643489.html