终于完成了自己的Dataset to CSV转换(所见即所得))

DataSet导出CSV格式 立即下载
public void ProduceCSV(DataGrid dgListBill,DataSet dsBill)
        {
            int colCount = dgListBill.Columns.Count;
            int valueRowCount = dsBill.Tables[0].Rows.Count;
            string[] dtHeader = new String[colCount];
            
            StringWriter sw=new StringWriter();
            sw.WriteLine("=year(d4)");
            string strColField,strLine;
            strLine ="";
            int k=0;//统计数据绑定的列数;
            //填充表头        
            for (int i=0 ;i<colCount;i++)
            {
                
                string colType = dgListBill.Columns[i].GetType().ToString();
                if (colType == "System.Web.UI.WebControls.BoundColumn")
                {
                    BoundColumn Col = (BoundColumn)dgListBill.Columns[i];
                    if (Col.HeaderText !="操作" && Col.Visible  && Col.DataField !=null)
                    {
                        dtHeader[k] = Col.DataField;
                        strLine += GetWriteableValue(Col.HeaderText)+"    ";
                        k++;
                    }
                }
            }
            sw.WriteLine(strLine);
            //            //填充内容            
            for(int i = 0;i<valueRowCount;i++)
            {
                strLine ="";
                for(int j=0;j<k;j++)
                {
                    strColField = dtHeader[j].ToString();
                    strLine += GetWriteableValue(dsBill.Tables[0].Rows[i][strColField])+"    ";

                }
                sw.WriteLine(strLine);
            }
            ResponseAttach(sw,"输出结果.xls","application/m*-**cel","attachment","gb2312");
            sw.Close();
        }


        public void ResponseAttach(StringWriter fileData,string strFileName,string ContentType,string OpMethod,string EncodingName)
        {
            Response.Clear();
            Response.Charset = "GB2312";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentType = ContentType; 
            Response.AppendHeader("Content-Disposition", OpMethod+";filename=" +Server.UrlEncode(strFileName)); 
            Response.ContentEncoding = System.Text.Encoding.GetEncoding(EncodingName);
            Response.Write(fileData.ToString());
            //Response.Flush();
            Response.End();
            //Response.Clear();
        } 
DATASET转csv DATASET转csv c# 立即下载

相关推荐

titanic_dataset.csv

titanic_dataset.csv titanic_dataset.csv titanic_dataset.csv 不多说了

将DataSet导出到CSV格式问题

本文引用下面的 Microsoft .NET 框架类库命名空间:   System.Data;   System.Web.UI.WebControls;      概要   本文解决将DataSet导出到CSV格式问题、将DataGrid中的数据导出到CSV格式问题      导出DataSet所有的列到CSV格式   遍历DataSet的Tables   遍历Table的Rows   遍历Row

在思考中沉淀...... 1220

深度可分离卷积(DepthwiseSeparableConvolution):Depthwise卷积与Pointwise卷积

深度可分离卷积不用多说,在轻量级网络架构方面是一个绕不开的话题,只要接触深度学习多多少少会接触。深度可分离卷积即DepthwiseSeparableConvolution,该卷积将一个常规卷积过程划分成两个完成Depthwise卷积和Pointwise卷积,在保证输出一样时,计算量大大降低。首先来看,一个常规卷积是怎么实现的。其示意图如果我们从通道数变换的角度来看,卷积就是将3通道的tensor变为了4通道的tensor,我们来看看深度可分离卷积是怎么实现通道的变化的。...

xu.hyj 1万+

DataSet导出CSV格式(ASP.NET,C#)

DataSet导出CSV格式(ASP.NET,C#) 作者:NotMSN:notking@hotmail.comEmail:nots@sohu.com 本文引用下面的 Microsoft .NET 框架类库命名空间:System.Data;System.Web.UI.WebControls; 概要本文解决将DataSet导出到CSV格式问题、将DataGrid中的数

忆 2175

InTouch历史报警与操作记录高效查询控件V4.0实战指南(一键下载即用)

本文详细介绍了InTouch历史报警与操作记录高效查询控件V4.0的实战应用。该控件针对原生AlmDbViewCtrl控件的查询效率低下、功能单一等问题,提供了智能查询、可视化统计、视图定制和一键导出Excel等强大功能,旨在帮助工程师快速处理海量历史数据,大幅提升工控运维效率。

g9h0i1的博客 964

NVIDIA Orin AGX开发环境搭建避坑指南:从Ubuntu 22.04到ROS2完整配置流程

本文详细介绍了NVIDIA Orin AGX开发环境搭建的全流程,从Ubuntu 22.04系统安装到ROS2深度优化,涵盖驱动部署、CUDA环境配置、散热与功耗管理等关键步骤。特别针对Orin AGX的特性提供了实用避坑指南和性能优化技巧,帮助开发者高效完成开发环境配置。

weixin_28340315的博客 457

将DataSet转换成CSV文件自己的用法

知识点:1、C#.NET 存换行符用/r/n,这样才会换行2、ds的每个table是有名字的 ds.Table[0].ToString()为表名table1 其中[0]是索引 表示ds的第一个表用法:Export2CSV(DsRyMajorTop, "Table1", false, "E:\\company\\JZ\\LDCX_xyw_datav\\pi11e.csv");

fans_langdou的专栏 3459

单点DToF激光测距传感器各家产品的比较

汇总DToF 单点测距传感器的相关信息

Linux 设备驱动概述及开发环境构建 (一) 1783

将DataSet导出为CSV格式

导出DataSet所有的列到CSV格式  遍历DataSet的Tables  遍历Table的Rows  遍历Rows的Columns    1/**////  &lt;summary&gt;   2///  将DataSet导出成CSV格式   3///  &lt;/summary&gt;   4///  &lt;param  name="ds"&gt;DataSet&lt;/param&...

weixin_34247032的博客 413

MounRiver Studio实战:像管理个人项目一样整理沁恒MCU的EVT例程(附文件结构图)

本文详细介绍了如何使用MounRiver Studio重构沁恒MCU的EVT例程,实现工程化管理。通过分析官方EVT设计的局限性,提出标准化的目录结构和迁移步骤,帮助开发者提升代码可维护性和团队协作效率。文章还提供了MounRiver Studio的关键配置参数和常见问题排查指南,适用于沁恒MCU开发者。

weixin_33940469的博客 359

Qt Creator设计器里也能拖拽?5步将你的QML自定义控件变成可视化插件(Qt6.5+)

本文详细介绍了如何在Qt Creator设计器中实现QML自定义控件的可视化拖拽功能(Qt6.5+)。通过5个步骤,从构建可插件化的QML控件基础到部署插件到设计器环境,帮助开发者将自定义控件转化为设计器插件,提升团队协作效率。特别适合需要频繁调整UI样式的开发场景。

weixin_29214559的博客 175

在.NET中将Dataset导出、导入CSV文件

from:http://www.cnblogs.com/chenyunfan/articles/599482.html 今天在别人的系统上做一个扩展小东东,其中有很多地方将DataSet中的数据导成csv文件,同时要求也能从csv文件直接导入数据,在网上查阅了一些相关资料总算搞定了,现简单写下来以备后用同时也希望能给有相同需求的朋友一定的帮助:     using System;using Sys...

weixin_34268579的博客 169

三菱FX系列PLC模拟量输入AD模块的使用方法和相关编程设置详解

三菱FX系列PLC模拟量输入AD模块的使用方法和相关编程设置详解

Robot_PLC_HMI_Automation 1万+

C#工具类 将DataTable和DataSet转换成CSV

using System; using System.Data; using System.IO; namespace YG._CommonFunctions { /// <summary> /// 数据转换成csv /// </summary> public static class Data2CSV { public static string GetColumnsByDataTable(DataTable dt) .

Gabriel_gu的博客 665

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

对Yelp dataset 中的数据进行json格式转csv操作

Yelp dataset原始数据集下载地址为:https://www.yelp.com/dataset/documentation/main 本人用到的两个数据集为yelp_photos.tar和yelp_dataset.tar,两个压缩包加一块大约10.3GB。 在GitHub上浏览基于yelp dataset数据集做的推荐系统项目时,发现人们用csv格式的数据集处理数据更加方便。而在GitH...

吱吱_的博客 4094

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

将DataSet写成CSV文件

<br />using System;<br /> using System.Collections.Generic;<br /> using System.Linq;<br /> using System.Text;<br /> using System.Data;<br /> using System.Data.SqlClient;<br /><br /> using System.IO;<br /> namespace Function<br /> {<br />     /// <

王雷 2147

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

DataFrame 转换为Dataset

写在前面: A DataFrame is a Dataset organized into named columns. A Dataset is a distributed collection of data. 贴代码: package february.sql import org.apache.spark.sql.SparkSession /** * Description: ...

留歌__36的博客 3580

Flink DataSet API

文章目录DataSet SourcesDataSet TransformationDataSet Sink序列化器一、样例一:读 csv 文件生成 csv 文件二、样例二:读 starrocks 写 starrocks三、样例三:DataSet、Table Sql 处理后写入 StarRocks四、`DataSet<Row>` 遍历 分类: Source:数据源创建初始数据集,例如来自文件或 Java 集合。 Transformation:数据转换将一个或多个 DataSet 转换为新的 Da

小强签名设计 的博客 1047

读取Csv文件返回DataSet的 二 种方法

方法一: #region 读取Csv文件返回DataSet /// <summary> /// 读取Csv文件返回DataSet /// </summary> /// <returns>Csv内容</returns> public DataSet ...

433

在.NET将dataset输出为.CSV文件的方法...

在.NET将dataset输出为.CSV文件的方法... 注意移除,和回车符Imports System.ConfigurationImports System.DataImports System.Data.OleDbImports Logonexperss.CustomerOnline.DBHelperImports System.IOPublic Class excle 

Ming.Blog. 1095

Tensorflow-datasetI使用_2.dataset转为csv文件,读取csv文件并训练生成model

import matplotlib as mpl # Matplotlib 是 Python 的绘图库。 它可与 NumPy 一起使用 import matplotlib.pyplot as plt # Python数据可视化matplotlib.pyplot # %matplotlib inline #在使用jupyter notebook 或者 jupyter qtconsole的时候...

hm成长之路 1024

Pytorch: 使用Dataset和DataLoader读取本地csv文件

import numpy as np import pandas as pd from PIL import Image from torch import optim,nn import torch.nn.functional as F from torchvision import transforms from torch.utils.data.dataset import Dataset...

weixin_35338624的博客 1万+

tech.ml.dataset数据导入导出:支持CSV、Excel、Parquet等10+格式的完整教程

**tech.ml.dataset**(简称TMD)是一个强大的Clojure高性能数据处理系统,它提供了丰富的数据导入导出功能,支持超过10种数据格式。无论你是数据科学家、分析师还是开发人员,掌握这些数据交换技巧将极大提升你的工作效率!🎯 [![tech.ml.dataset数据导入导出功能展示](https://raw.gitcode.com/gh_mirrors/te/tech.ml.d

gitblog_00989的博客 935

XML转换为CSV

Code 1protectedvoidPage_Load(objectsender,EventArgse) 2{ 3stringFileId=Request["FileId"].ToString(); 4 5stringvalstr=""; 6 7System.IO.S...

aiwenia0512的博客 662
下一篇: 几种数据库连接字符串
torcher
博客等级 码龄24年 8粉丝 25原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值