public ClientUser(CommConnection conn) { this.conn = conn; // // TODO: 在此加入建構函式的程式碼 // }
public int GetIDX() { CommConnection conn = new CommConnection(this.Connection.ConnectionString, this.Connection.ConnectionType); conn.Tran(); conn.ExecuteNonQuery("Update _IDX Set IDX = IDX + 1"); DataTable dt = conn.ExecuteData("Select IDX From _IDX"); int i = (int)dt.Rows[0][0]; conn.Commit(); conn.Dispose(); return i; }
public int GetIDX() { CommConnection conn = new CommConnection(this.Connection.ConnectionString, this.Connection.ConnectionType); conn.Tran(); conn.ExecuteNonQuery("Update _IDX Set IDX = IDX + 1"); DataTable dt = conn.ExecuteData("Select IDX From _IDX"); int i = (int)dt.Rows[0][0]; conn.Commit(); conn.Dispose(); return(i); }
/// <summary> /// 收集Table的Key Value對應表,主要提供給Grid的代碼類欄位做轉換,可減沙在SQL做Table Join 。 /// </summary> /// <param name="idTabFields">Id欄位</param> /// <param name="nameTabFields">Text欄位</param> /// <param name="conn">Connection連線</param> /// <returns> Dictionary int String </returns> public Dictionary <int, String> CollectIdNameFields( Expression <Func <TabObjSource, FieldModule> > idTabFields, Expression <Func <TabObjSource, FieldModule> > nameTabFields, CommConnection conn ) { Func <TabObjSource, FieldModule> id = idTabFields.Compile(); Func <TabObjSource, FieldModule> name = nameTabFields.Compile(); FieldModule fieldId = id.Invoke(this.GetTabObj); FieldModule fieldName = name.Invoke(this.GetTabObj); String sql = String.Format("Select {0},{1} From {2}", fieldId.N, fieldName.N, this.N); DataTable dt = conn.ExecuteData(sql); Dictionary <int, String> data = new Dictionary <int, String>(); foreach (DataRow dr in dt.Rows) { data.Add(dr[fieldId.N].CInt(), dr[fieldName.N].ToString()); } return(data); }