using System; using System.Collections.Generic; using System.Text; using System.Data.SqlClient; using System.Data; using System.Globalization; using System.Threading; using System.Drawing; using System.IO; using System.Windows.Forms; using System.Reflection; amespace Kommissionierung { public static class __DataRequest { private static string rowValue = ""; private static string Status; private static string ArtikelNr; private static int index = 0; private static string Mitarbeiter; private static string ArtikelName; private static bool result = true; private static string prioritaet; private static DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn(); public static DataTable KommissionAktualisieren(DataGridView dg) { DataTable dt = new DataTable(); using (SqlConnection connection = new SqlConnection()) { connection.ConnectionString = Properties.Settings.Default.KomissionierungDemoConnectionString; DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter( try { da.SelectCommand = new SqlCommand("SELECT * FROM V_KommissionAnsicht ", connection); ds.Clear(); da.Fill(ds); dt = ds.Tables[0]; DataTable dt2 = new DataTable(); DataRow row; foreach (DataTable dts in ds.Tables) { foreach (DataRow dr in dts.Rows) { row = dt2.NewRow(); ArtikelNr = dr.ItemArray[2].ToString(); Status = dr.ItemArray[4].ToString(); Mitarbeiter = dr.ItemArray[3].ToString(); prioritaet = dr.ItemArray[5].ToString(); if (dt2.Columns.Contains("Artikel") == false) { chk.Name = "checked"; chk.HeaderText = "Text"; chk.Resizable = DataGridViewTriState.False; dg.Columns.Add(chk); dt2.Columns.Add("Artikel"); } if (dt2.Columns[0].ToString() == "Artikel") { row["Artikel"] = dr.ItemArray[1].ToString(); ArtikelName = row["Artikel"].ToString(); } if (dt2.Columns.Contains("ArtikelNr") == false) { dt2.Columns.Add("ArtikelNr"); } if (dt2.Columns[1].ToString() == "ArtikelNr") { row["ArtikelNr"] = dr.ItemArray[2].ToString(); } if (dt2.Columns.Contains("Prioritaet") == false) { dt2.Columns.Add("Prioritaet"); } if (dt2.Columns[2].ToString() == "Prioritaet") { row["Prioritaet"] = dr.ItemArray[5].ToString(); } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)