无法将数据库中的值写入INI文件

时间:2011-02-21 21:55:57

标签: c#

我正在尝试在.ini文件中写入值。我已经建立了与数据库的连接并且可以获取数据,但是对于我来说,我无法在.ini文件中正确输出数据。我希望输出为:

Row1 = column1 value - column2 value
Row2 = column1 value - column2 value
Row3 = column1 value - column2 value

//xcount is number of records in the data table
int xcount;
int primary;
primary = int.Parse(deviceNumTextBox.Text);
// get the data

if (primary == 99)
{
    xcount = int.Parse(countLabel1.Text);
    for (int t = 0; t < xcount; t++)
    {
        int j = 0;

        da.Fill(dt);
        foreach (DataRow row in dt.Rows)
        //foreach (DataRow row in dt.Rows)
        {
            string str;
            string nfloatAmt = (string)row[0];
            string ndeviceNum = (string)row["deviceNum"];
            //using (TextWriter writer = new StreamWriter("test.txt", true))  // true is for append mode
            //{

            //}
            j++;
            str = "ROW " + j.ToString() +row["floatAmt"].ToString() + "^" + row["deviceNum"].ToString();
            source.Configs["STORE"].Set("FLOAT"+t, str );
        }
    }
}

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

您是否尝试过使用断点逐行完成代码?这就是我要做的。

相关问题