ELSE IF(@Event = 'getOperatorInfo') BEGIN SELECT operatorCode,operatorClient,operatorName,Expiration FROM codecoOperatorInfo WHERE operatorCode = @operatorCode AND operatorClient = @operatorClient SELECT operatorRecipients FROM codecoOperatorsRecipients WHERE operatorCode = @operatorCode AND operatorClient = @operatorClient END
public List<operatorSettingsDO> getOperatorInfo(string Code, string Client) { var oOperatorSettingsDO = new List<operatorSettingsDO>(); using (SqlConnection oConnection = new SqlConnection(sqlConnection)) { using (SqlCommand oCommand = new SqlCommand("spCodeco", oConnection)) { oCommand.Connection = oConnection; oCommand.CommandType = CommandType.StoredProcedure; oCommand.Parameters.AddWithValue("@Form", "operatorSettings"); oCommand.Parameters.AddWithValue("@Event", "getOperatorInfo"); oCommand.Parameters.AddWithValue("@operatorCode", Code); oCommand.Parameters.AddWithValue("@operatorClient", Client); SqlDataReader oReader = null; try { oConnection.Open(); oReader = oCommand.ExecuteReader(); while (oReader.Read()) { operatorSettingsDO opSettingsDO = new operatorSettingsDO(); opSettingsDO.operatorCode = oReader["operatorCode"].ToString(); opSettingsDO.operatorClient = oReader["operatorClient"].ToString(); opSettingsDO.operatorName = oReader["operatorName"].ToString(); opSettingsDO.Expiration = (DateTime)oReader["Expiration"]; opSettingsDO.Recipients = oReader["operatorRecipients"].ToString(); oOperatorSettingsDO.Add(opSettingsDO); } } catch (Exception ex) { throw ex; } } } return oOperatorSettingsDO; }
catch (Exception ex) { throw ex; }
throw;
throw ex;
catch (Exception ex) { throw; }
try..catch
var result = new DataSet(); var dataAdapter = new SqlDataAdapter(command); dataAdapter.Fill(result);
result.Tables[0]
result.Tables[1]
SQL Data Adapter
Multiple Result Sets If the DataAdapter encounters multiple result sets, it creates multiple tables in the DataSet. The tables are given an incremental default name of TableN, starting with "Table" for Table0. If a table name is passed as an argument to the Fill method, the tables are given an incremental default name of TableNameN, starting with "TableName" for TableName0.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)