PC Review


Reply
Thread Tools Rate Thread

Confused about MissingSchemaAction.AddWithKey

 
 
=?Utf-8?B?VG9ueQ==?=
Guest
Posts: n/a
 
      28th Jan 2005
Hi!
I 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();
}

 
Reply With Quote
 
 
 
 
NuTcAsE
Guest
Posts: n/a
 
      28th Jan 2005
AddWithKey will specify the adapter to also retreive the table schema
and identify the primary keys in the table. Looking at your code i dont
think you need to specify AddWithKey since you are not doing any
specific processing based on the primary key of the table.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
missingschemaaction david.cawkwell@tesco.net Microsoft VB .NET 0 5th Dec 2007 12:46 PM
DataAdapter & AddWithKey Micus Microsoft ADO .NET 0 22nd Oct 2006 08:07 PM
MissingSchemaAction.AddWithKey fails with DISTINCT Howell Page Microsoft ADO .NET 1 26th Feb 2006 10:20 PM
MissingMappingAction and MissingSchemaAction Jiho Han Microsoft ADO .NET 1 12th Oct 2005 08:03 PM
MissingSchemaAction Jim Heavey Microsoft ADO .NET 1 29th Dec 2003 09:44 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:11 AM.