我試圖將SQL-Server查詢導出到XML文件,並且我想將該文件導入到Access。我不明白如何做到這一點。import xml to mdb
這裏是我用來生成XML的代碼:
protected void Button1_Click(object sender, EventArgs e) {
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["SqlSconn"].ConnectionString);
con.Open();
string strSQL = "select * from dbo.table_"+test.Text.ToString()+"";
SqlDataAdapter dt = new SqlDataAdapter(strSQL, con);
DataSet ds = new DataSet();
dt.Fill(ds, "" + test.Text.ToString() + "");
ds.WriteXml(Server.MapPath("temp.xml"));
}
這不是你想要投入訪問的查詢,但結果集。爲了導入訪問,您必須以Access友好格式輸出或通過另一個數據庫連接直接連接到Access DB。 – 2012-10-31 18:23:48
我有一個xml文件.. – userprofile1
在Access中,嘗試'外部數據' - >'XML文件',然後按照嚮導步驟將結果集導入到一個表中。 – 2012-10-31 18:38:39