标题:数据存储疑问...求大侠解答
取消只看楼主
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



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-373818-1-1.html




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

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