|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Confused about MissingSchemaAction.AddWithKeyI am trying to improve the speed of the app. Can you tell me if i need to use AddWithKey or not? Thanks. if (base.OpenDB() != System.Data.ConnectionState.Open) { throw new Exception("Unable to open DB connection!"); } string sSQL = "SELECT * FROM PROCESSCONTROLVIEW WHERE GROUP_ID = '" + sTemp + "'"; da = new SqlDataAdapter(sSQL, base.Connection); ds = new System.Data.DataSet(); cb = new SqlCommandBuilder(da); da.MissingSchemaAction = MissingSchemaAction.AddWithKey; da.Fill(ds, "PROCESSCONTROLVIEW"); if (ds.Tables["PROCESSCONTROLVIEW"].Rows.Count != 1) return new VCDI(); try { cdi.Head.PressNum = ds.Tables["PROCESSCONTROLVIEW"].Rows[0]["PRESS_NUM"].ToString().ToCharArray(); } catch (Exception) { cdi.Head.PressNum[0] = '\x30'; cdi.Head.PressNum[1] = '\0'; } try { cdi.Head.LayNum = ds.Tables["PROCESSCONTROLVIEW"].Rows[0]["LAY_NUM"].ToString().ToCharArray(); } catch (Exception) { cdi.Head.LayNum[0] = '\x30'; cdi.Head.LayNum[1] = '\0'; } try { cdi.Head.ReadTime = DateTime.Parse(ds.Tables["PROCESSCONTROLVIEW"].Rows[0]["READDATE"].ToString()); } catch (Exception) { cdi.Head.ReadTime = DateTime.Now; } try { cdi.Head.ReaderNumber = ds.Tables["PROCESSCONTROLVIEW"].Rows[0]["READER_NUM"].ToString().ToCharArray(); } catch (Exception) { cdi.Head.ReaderNumber = "0".ToCharArray(); }
Other interesting topics
Data reader already open?
Question about SQLDataReader Concurrency in N tiers How do I filter a child table through its parent? help to nav through DataReader infoMessage Truncated OleDbParameter doesn't update value correctly # of pooled connections seem too high What is the Best way to fetch the most recent updated row in a database preventing new rows in datagrids when using relations |
|||||||||||||||||||||||