/// <summary> /// Add your parameters in correct order by using this adapters (Select)Command in AddParameter and addSystemParameters /// </summary> /// <param name="sConnectionString"></param> /// <param name="sCommandText"></param> /// <param name="sTable"></param> /// <returns></returns> public static System.Data.IDbDataAdapter GetDbDataAdapter(string sConnectionString, string sCommandText, string sTable) { // Copied SelectCommand from generated AdoDataSetCommand (changed param values) XrDbDataAdapter daDataAdapter = new XrDbDataAdapter(); XrDbCommand oCmd = new XrDbCommand(); XrDbConnection oConn = (XrDbConnection)GetConnection(sConnectionString); oCmd.Connection = oConn; oCmd.CommandText = sCommandText; oCmd.CommandType = System.Data.CommandType.StoredProcedure; daDataAdapter.SelectCommand = oCmd; daDataAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", sTable) }); return(daDataAdapter); }
/// <summary> /// Returns an Initialized DataAdapter /// </summary> /// <param name="oConn">A DataBase Connection</param> /// <param name="sCommandText">The Command Text</param> /// <param name="lUserID">The UserID</param> /// <param name="lOwnerID">The OwnerID</param> /// <param name="lLanguageID">The LanguageID</param> /// <param name="lRoleID">The RoleID</param> /// <returns>The Initialized DataAdapter</returns> public static System.Data.IDbDataAdapter GetListDbDataAdapter(System.Data.IDbConnection oConn, string sCommandText, long lUserID, long lOwnerID, long lLanguageID, long lRoleID) { // Copied SelectCommand from generated AdoDataSetCommand (changed param values) XrDbDataAdapter oDataAdapter = new XrDbDataAdapter(); XrDbCommand oCmd = new XrDbCommand(); oCmd.Connection = (XrDbConnection)oConn; oCmd.CommandText = sCommandText; oCmd.CommandType = System.Data.CommandType.StoredProcedure; AddStandardParameters(oCmd, lUserID, lOwnerID, lLanguageID, lRoleID); oDataAdapter.SelectCommand = oCmd; oDataAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", "List", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("l_value", "l_value"), new System.Data.Common.DataColumnMapping("s_text", "s_text") }) }); return(oDataAdapter); }