Esempio n. 1
0
        private void RunTeradata(List <SQLResult> result, string cmd)
        {
            try
            {
                TdCommand toGo = this.TdConnection.CreateCommand();
                toGo.CommandTimeout = 3600 * 12;
                toGo.CommandText    = cmd;

                TdDataReader reader = toGo.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        int       nCol    = reader.FieldCount;
                        SQLResult newItem = new SQLResult();

                        if (nCol > 0)
                        {
                            newItem.Column0 = reader.IsDBNull(0) ? String.Empty : reader.GetValue(0).ToString();
                        }
                        if (nCol > 1)
                        {
                            newItem.Column1 = reader.IsDBNull(1) ? String.Empty : reader.GetValue(1).ToString();
                        }
                        if (nCol > 2)
                        {
                            newItem.Column2 = reader.IsDBNull(2) ? String.Empty : reader.GetValue(2).ToString();
                        }
                        if (nCol > 3)
                        {
                            newItem.Column3 = reader.IsDBNull(3) ? String.Empty : reader.GetValue(3).ToString();
                        }
                        if (nCol > 4)
                        {
                            newItem.Column4 = reader.IsDBNull(4) ? String.Empty : reader.GetValue(4).ToString();
                        }
                        if (nCol > 5)
                        {
                            newItem.Column5 = reader.IsDBNull(5) ? String.Empty : reader.GetValue(5).ToString();
                        }
                        if (nCol > 6)
                        {
                            newItem.Column6 = reader.IsDBNull(6) ? String.Empty : reader.GetValue(6).ToString();
                        }

                        result.Add(newItem);
                    }
                }

                reader.Close();
                toGo.Dispose();
            }
            catch (Exception ex)
            {
                throw;
            }
        }