You need simple event where you can put this C# code:
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text != "" && textBox2.Text !="" && textBox3.Text != "")
{
string cmd= "Select * from "+textBox3.Text+"";
string conn= textBox2.Text;
DataSet ds = new DataSet();
System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(cmd,conn);
da.Fill(ds);
// Write to XML here
ds.WriteXml(textBox3.Text+".xml", XmlWriteMode.WriteSchema);
dataGridView1.DataSource = ds.Tables[0];
}
MessageBox.Show("Uspješno !");
}
0 comments:
Post a Comment