| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 356 人关注过本帖
标题:数据存储疑问...求大侠解答
取消只看楼主 加入收藏
BlizzardKen
Rank: 1
来 自:广西桂林
等 级:新手上路
帖 子:36
专家分:0
注 册:2011-4-26
结帖率:33.33%
收藏
已结贴  问题点数:20 回复次数:0 
数据存储疑问...求大侠解答
图片附件: 游客没有浏览图片的权限,请 登录注册


using System;

using System.Collections.Generic;

using

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using

using System.Runtime.InteropServices;
using MySql.Data;
using MySql.Data.MySqlClient;

namespace Post
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
   
        }
     //   public struct Information
    //    {
    //        public string Name;
    //        public int Number;
    //        public int SellPrice;
    //        public int UnitPrice;
    //        public int BarCode;
        
     //   }
        private void button1_Click(object sender, EventArgs e)
        {
            string filepath =@"D:\My Documents\Visual Studio 2008\Projects\Post\Post\Data\2012720.013";
            StreamWriter sw = new StreamWriter(filepath, true, System.Text.Encoding.GetEncoding("GB2312"));
            string fs = "";
            for (int i = 0; i < (dataGridView1.Rows.Count - 1); i++)
            {
                fs = "";
                for (int j = 0; j < dataGridView1.Columns.Count; j++)
                {
                    //currentcell :访问当前表格;
                    this.dataGridView1.CurrentCell = this.dataGridView1.Rows[i].Cells[j];
                    Clipboard.SetDataObject(dataGridView1.GetClipboardContent());
                    fs =fs+Clipboard.GetText().ToString()+" || ";
                }
                sw.WriteLine(fs);
            }
            sw.Flush();
            sw.Close();
        }



    }
}
这是直接存到txt文档中的,我想知道怎么通过结构体数组来存储数据,然后再转存到TXT文本中,哪位高手帮忙修改下代码,让我参考下
[local]1[/local]


[ 本帖最后由 BlizzardKen 于 2012-7-21 11:39 编辑 ]
搜索更多相关主题的帖子: private public 
2012-07-21 11:37
快速回复:数据存储疑问...求大侠解答
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012817 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved