小总结
1.String.IsNullOrEmpty(sID)
2. StringBuilder ss = new StringBuilder();
foreach (string s in _oRemarkKeyList.Values)
ss.Append("[").Append(s).Append("]");
_sRemark = ss.ToString();
3. DataRow dr = _oDishsSort.NewRow();
dr.ItemArray = new object[] { ALL_SORT_L, "00", "[所有分类]", 1 };
_oDishsSort.Rows.InsertAt(dr, 0);
4. oBut.Text = String.Format("{0}{1}\n\r ¥{2}/{3}", _oDvDish[_iNoDish]["menu_cname"],
sSet,Convert.ToDouble(_oDvDish[_iNoDish]["price"]), _oDvDish[_iNoDish]["unit"]);
5. if (Convert.ToBoolean(_oDvDish[_iNoDish]["ifsuit"]))
sSet = "[套]";
6.DataRow oRow = (oDishBut.Tag as DataRow);
if (oRow == null)
return;
7. int i = this.flpanSelDish.Controls.IndexOf(oRBut);
检索控件集合中指定控件的索引
8。private List<DataRow> _oDvDish = new List<DataRow>();//通过索引访问
private List<CSelDish> _oLstSelDish = new List<CSelDish>();
Dictionary<string, string> _oRemarkKeyList = new Dictionary<string, string>();//键值集合
9。using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Data;
namespace MidasTouch
{
/// <summary>
/// 存储信息的类,用于各种信息
/// </summary>
public class DataInfo
{
private Hashtable _oDataInfo = new Hashtable();
public DataInfo(DataRow oRow)
{
foreach (DataColumn oCol in oRow.Table.Columns)
{
_oDataInfo.Add(oCol.ColumnName, oRow[oCol]);
}
}
/// <summary>
/// 设置和获取该项的内容
/// </summary>
/// <param name="sName">项的名字</param>
/// <returns>返回值</returns>
public object this[string sName]
{
get
{
return _oDataInfo[sName];
}
set
{
_oDataInfo[sName] = value;
}
}
/// <summary>
/// 该信息的条数
/// </summary>
public int Count
{
get
{
return _oDataInfo.Count;
}
}
}
}
12。
app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ConnectionString" value="Data Source=Initial Catalog=YGCY;Data Source=KELVIN;;User ID=yg001"/>
</appSettings>
</configuration>
连接字符串
private string _sConnStr = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"];
/// <summary>
/// 连接数据库的连接串
/// </summary>
public string ConnStr
{
get
{
return _sConnStr;
}
set
{
_sConnStr = value;
}
}