开发者

Trouble writing values from database to INI file

I am trying to write values in an .ini file. I have made the connection to the database and can get the data but for the life of me I cannot get it to output correctly in the .ini file. I would like the output to be:

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)
        {
            stri开发者_JS百科ng 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 );
        }
    }
}

Any help would be greatly appreciated.


Have you tried to go through the code line by line with a breakpoint? This is what I'd do.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜