本文整理汇总了C#中System.Data.DataRow类的典型用法代码示例。如果您正苦于以下问题:C# DataRow类的具体用法?C# DataRow怎么用?C# DataRow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataRow类属于System.Data命名空间,在下文中一共展示了DataRow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataRowToModel
/// <summary>
/// 得到一个对象实体
/// </summary>
public HisClient.Model.his_comm_dict_type DataRowToModel(DataRow row)
{
HisClient.Model.his_comm_dict_type model=new HisClient.Model.his_comm_dict_type();
if (row != null)
{
if(row["ID"]!=null)
{
model.ID=row["ID"].ToString();
}
if(row["TYPE_CODE"]!=null)
{
model.TYPE_CODE=row["TYPE_CODE"].ToString();
}
if(row["TYPE_NAME"]!=null)
{
model.TYPE_NAME=row["TYPE_NAME"].ToString();
}
if(row["HELP_CODE"]!=null)
{
model.HELP_CODE=row["HELP_CODE"].ToString();
}
if(row["CREATE_DATE"]!=null && row["CREATE_DATE"].ToString()!="")
{
model.CREATE_DATE=DateTime.Parse(row["CREATE_DATE"].ToString());
}
if(row["CREATE_BY"]!=null)
{
model.CREATE_BY=row["CREATE_BY"].ToString();
}
}
return model;
}
示例2: GetFactory
public static DbProviderFactory GetFactory(DataRow providerRow)
{
ADP.CheckArgumentNull(providerRow, "providerRow");
DataColumn column = providerRow.Table.Columns["AssemblyQualifiedName"];
if (column != null)
{
string str = providerRow[column] as string;
if (!ADP.IsEmpty(str))
{
Type type = Type.GetType(str);
if (null == type)
{
throw ADP.ConfigProviderNotInstalled();
}
FieldInfo field = type.GetField("Instance", BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly);
if ((null != field) && field.FieldType.IsSubclassOf(typeof(DbProviderFactory)))
{
object obj2 = field.GetValue(null);
if (obj2 != null)
{
return (DbProviderFactory) obj2;
}
}
throw ADP.ConfigProviderInvalid();
}
}
throw ADP.ConfigProviderMissing();
}
示例3: DataBind
public virtual void DataBind(DataRow row)
{
this.PONum = (int)row["PONum"].GetInt();
this.Revision = (int)row["Revision"].GetInt();
this.OpenOrder = (int)row["OpenOrder"].GetInt();
this.VoidOrder = (int)row["VoidOrder"].GetInt();
this.EntryPerson = (string)row["EntryPerson"].GetString();
this.OrderDate = (DateTime)row["OrderDate"].GetDate();
this.TermsCode = (string)row["TermsCode"].GetString();
this.VendorNum = (int)row["VendorNum"].GetInt();
this.SupplierName = (string)row["SupplierName"].GetString();
this.CurrencyCode = (string)row["CurrencyCode"].GetString();
this.ExchangeRate = (int)row["ExchangeRate"].GetInt();
this.ApprovedDate = (DateTime)row["ApprovedDate"].GetDate();
this.ApprovedBy = (string)row["ApprovedBy"].GetString();
this.Approve = (int)row["Approve"].GetInt();
this.ApprovalStatus = (string)row["ApprovalStatus"].GetString();
this.ApprovedAmount = (int)row["ApprovedAmount"].GetInt();
this.CustId = (string)row["CustId"].GetString();
this.CustomerName = (string)row["CustomerName"].GetString();
this.MakerCode = (string)row["MakerCode"].GetString();
this.MakerName = (string)row["MakerName"].GetString();
this.MillCode = (string)row["MillCode"].GetString();
this.MillName = (string)row["MillName"].GetString();
this.SaleContractNum = (string)row["SaleContractNum"].GetString();
this.SaleContractDate = (DateTime)row["SaleContractDate"].GetDate();
this.ImportCode = (string)row["ImportCode"].GetString();
this.CalculateCode = (string)row["CalculateCode"].GetString();
this.SectionCode = (string)row["SectionCode"].GetString();
}
示例4: GetPetFromDatabaseRow
public static Pet GetPetFromDatabaseRow(DataRow Row)
{
return new Pet((uint)Row["id"], (string)Row["name"], (int)Row["type"], (int)Row["race"],
(uint)Row["user_id"], (uint)Row["room_id"], Vector3.FromString((string)Row["room_pos"]),
(double)Row["timestamp"], (int)Row["experience"], (int)Row["energy"], (int)Row["happiness"],
(int)Row["score"]);
}
示例5: UCPersonnelAddOrEdit
public UCPersonnelAddOrEdit(DataRow dr, string parentName)
{
InitializeComponent();
this.dr = dr;
this.parentName = parentName;
Update = new UpdateDele(DBHelper.WebServHandlerByFun);
}
示例6: Add
/// <summary>
/// 增加一条数据
/// </summary>
public int Add(DataRow dr, SqlTransaction trans)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("INSERT INTO hrCompanyShopInfo(");
strSql.Append("MainID,sShopID,sShopCName,sShopEName,sRemark,sUserID)");
strSql.Append(" VALUES (");
strSql.Append("@MainID,@sShopID,@sShopCName,@sShopEName,@sRemark,@sUserID)");
strSql.Append(";SELECT @@IDENTITY");
SqlParameter[] parameters = {
new SqlParameter("@MainID", SqlDbType.Int,4),
new SqlParameter("@sShopID", SqlDbType.VarChar,30),
new SqlParameter("@sShopCName", SqlDbType.VarChar,50),
new SqlParameter("@sShopEName", SqlDbType.VarChar,50),
new SqlParameter("@sRemark", SqlDbType.VarChar,200),
new SqlParameter("@sUserID", SqlDbType.VarChar,30)};
parameters[0].Value = dr["MainID"];
parameters[1].Value = dr["sShopID"];
parameters[2].Value = dr["sShopCName"];
parameters[3].Value = dr["sShopEName"];
parameters[4].Value = dr["sRemark"];
parameters[5].Value = dr["sUserID"];
object obj = DbHelperSQL.GetSingle(strSql.ToString(), trans, parameters);
if (obj == null)
{
return -1;
}
else
{
return Convert.ToInt32(obj);
}
}
示例7: Init
private void Init(DataRow dataRow)
{
if (_dataRow == null && dataRow != null)
_createColumns = dataRow.Table.Columns.Count == 0;
_dataRow = dataRow;
}
示例8: DataBind
public override void DataBind(DataRow row)
{
base.DataBind(row);
this.PONum = (int)row["PONum"].GetInt();
this.PONumber = (string)row["PONumber"].GetString();
}
示例9: Volunteer
public Volunteer(DataRow row)
{
this.ID = (int)row["ID"];
this.FirstName = row["FirstName"] as string;
this.MiddleNames = row["MiddleName"] as string;
this.LastName = row["Surname"] as string;
}
示例10: Create
public string Create( DataRow p)
{
string id = Guid.NewGuid().ToString();
string sql = "";
sql = " insert into Templet( "
+" id, "
+ " corp_id,"
+ " name,"
+ " docpath,"
+ " creatorid,"
+ " createtime,"
+ " status"
+ " ) values("
+ " '" + StringHelper.ChkSQL(id) + "',"
+ " '" + StringHelper.ChkSQL(p["corp_id"].ToString()) + "',"
+ " '" + StringHelper.ChkSQL(p["name"].ToString()) + "',"
+ " '" + StringHelper.ChkSQL(p["docpath"].ToString()) + "',"
+ " '" + StringHelper.ChkSQL(p["creatorid"].ToString()) + "',"
+ " getdate() ,"
+ " 1 " //status
+ " ) ";
commonDAL.ExecSQL( sql);
return id;
}
示例11: TypedUserFind
/// <summary>
/// Initializes a new instance of the <see cref="TypedUserFind"/> class.
/// </summary>
/// <param name="row">
/// The row.
/// </param>
public TypedUserFind(DataRow row)
{
this.UserID = row.Field<int?>("UserID");
this.BoardID = row.Field<int?>("BoardID");
this.Name = row.Field<string>("Name");
this.Password = row.Field<string>("Password");
this.Email = row.Field<string>("Email");
this.Joined = row.Field<DateTime?>("Joined");
this.LastVisit = row.Field<DateTime?>("LastVisit");
this.IP = row.Field<string>("IP");
this.NumPosts = row.Field<int?>("NumPosts");
this.TimeZone = row.Field<int?>("TimeZone");
this.Avatar = row.Field<string>("Avatar");
this.Signature = row.Field<string>("Signature");
this.AvatarImage = row.Field<byte[]>("AvatarImage");
this.RankID = row.Field<int?>("RankID");
this.Suspended = row.Field<DateTime?>("Suspended");
this.LanguageFile = row.Field<string>("LanguageFile");
this.ThemeFile = row.Field<string>("ThemeFile");
this.Flags = row.Field<int?>("Flags");
this.PMNotification = row.Field<bool?>("PMNotification");
this.Points = row.Field<int?>("Points");
this.IsApproved = row.Field<bool?>("IsApproved");
this.IsActiveExcluded = row.Field<bool?>("IsActiveExcluded");
this.UseMobileTheme = row.Field<bool?>("OverrideDefaultThemes");
this.AvatarImageType = row.Field<string>("AvatarImageType");
this.AutoWatchTopics = row.Field<bool?>("AutoWatchTopics");
this.TextEditor = row.Field<string>("TextEditor");
this.DisplayName = row.Field<string>("DisplayName");
this.Culture = row.Field<string>("Culture");
this.NotificationType = row.Field<int?>("NotificationType");
this.DailyDigest = row.Field<bool?>("DailyDigest");
this.IsGuest = row.Field<bool>("IsGuest");
this.ProviderUserKey = this.IsGuest ? null : ObjectExtensions.ConvertObjectToType(row.Field<string>("ProviderUserKey"), Config.ProviderKeyType);
}
示例12: DataToField
public void DataToField(DataRow row, object record) // TypedReference t)
{
try
{
GetColumnIndex(row);
if (mCheckTypeFlag == 0)
{
mColumnType = row.Table.Columns[mDataColumnIndex].DataType;
if (mColumnType == mField.FieldType)
mCheckTypeFlag = 1;
else
mCheckTypeFlag = 2;
}
if (mCheckTypeFlag == 1)
mField.SetValue(record, row[mDataColumnIndex]);
else if (row[mDataColumnIndex] != DBNull.Value)
mField.SetValue(record, Convert.ChangeType(row[mDataColumnIndex], mField.FieldType));
else // IS DB NULl
{
if (mColumnType == typeof (string))
mField.SetValue(record, string.Empty);
}
}
catch
{
throw new FileHelpersException(string.Format("Error converting value: {0} to {1} in the column with index {2} and the field {3}", row[mDataColumnIndex], mField.FieldType, mDataColumnIndex, mField.Name));
}
}
示例13: SpellViewInfo
public static void SpellViewInfo(DataRow spellInfo, RichTextBox _rtSpellInfo)
{
_rtSpellInfo.SelectionColor = Color.Blue;
_rtSpellInfo.AppendText(ViewTextInfo(spellInfo));
_rtSpellInfo.SelectionColor = Color.Black;
_rtSpellInfo.AppendText(ViewAttribute(spellInfo));
_rtSpellInfo.AppendText(ViewMask(spellInfo));
_rtSpellInfo.AppendText(ViewProcFlag(spellInfo));
_rtSpellInfo.AppendText(ViewFlags(spellInfo));
_rtSpellInfo.AppendText(ViewSpellFields(spellInfo, typeof(SpellFieldBloc1)));
_rtSpellInfo.AppendText(ViewSpellFields(spellInfo, typeof(SpellFieldBloc2)));
_rtSpellInfo.AppendText(ViewSpellFields(spellInfo, typeof(SpellFieldBloc3)));
_rtSpellInfo.AppendText(ViewInfoFromOtherTable(spellInfo));
_rtSpellInfo.AppendText(ViewReagent(spellInfo));
_rtSpellInfo.AppendText(ViewSpellFields(spellInfo, typeof(SpellFields2), 2));
_rtSpellInfo.AppendText(ViewSpellFields(spellInfo, typeof(SpellFields3), 3));
_rtSpellInfo.AppendText(ViewSpellItemInfo(spellInfo));
}
示例14: LoadData
public override void LoadData(DataRow CurrentDataRow, IDbConnection conn)
{
IsLoaded = false;
CurrentFRDBase = (GISADataset.FRDBaseRow)CurrentDataRow;
IsLoaded = true;
}
示例15: DataRowToModel
/// <summary>
/// 得到一个对象实体
/// </summary>
public ECommerce.Admin.Model.Logs DataRowToModel(DataRow row)
{
ECommerce.Admin.Model.Logs model = new ECommerce.Admin.Model.Logs();
if (row != null)
{
if (row["LID"] != null && row["LID"].ToString() != "")
{
model.LID = Convert.ToInt64(row["LID"].ToString());
}
if (row["LLID"] != null && row["LLID"].ToString() != "")
{
model.LLID = Convert.ToInt64(row["LLID"].ToString());
}
if (row["OValue"] != null)
{
model.OValue = row["OValue"].ToString();
}
if (row["NValue"] != null)
{
model.NValue = row["NValue"].ToString();
}
if (row["FName"] != null)
{
model.FName = row["FName"].ToString();
}
}
return model;
}