samedi 9 mai 2015

How to to Open the XML from Database to Windows Form

In SQL table I have XML data. I want to open that XML in windows forms application on Button Click.

   private void button2_Click(object sender, EventArgs e)
    {
        string s = textBox1.Text;
        con.Open();
        SqlCommand cmd1 = new SqlCommand("select XMLfrom XMLTable where ID='" + textBox1.Text + "'", con);
        SqlDataAdapter da1 = new SqlDataAdapter(cmd1);
        con.Close();
        DataSet ds1 = new DataSet();
        da1.Fill(ds1);
        gv_InputXML.AutoGenerateColumns = true;
        gv_InputXML.DataSource = ds1;
    }

When I write this I could not get any thing in DS.

How can I read XML from DB?

Aucun commentaire:

Enregistrer un commentaire