G
Guest
I am using the following code and it works fine. Instead of hard coding the
location for saving the file I will like to use the file dialog box in
windows. So that the user and give a name to the file and also select a
location to save it in. I then would like to grab the path and file name
information and use that to save the dataset.
PLS help I will be forever grateful.
Thanks
(e-mail address removed)
Dim strSQL As String
strSQL = "SELECT top 200 ID, STATUS,LAST_FIRST ,COMPANY FROM Name"
Dim strConn As String
strConn = "User ID=ss;pwd = 123;Initial Catalog=IMIS_PRODUCTION;Data
Source=NEITESTDB"
Dim sqlconn As New SqlConnection(strConn)
sqlconn.Open()
Dim sqlDA As New SqlDataAdapter(strSQL, sqlconn)
Dim objds As New DataSet()
sqlDA.Fill(objds, "dtnames")
objds.WriteXml("c:\imis_web_test.xls")
dg1.DataSource = objds.Tables.Item("dtnames")
'dg1.PagerStyle.NextPageText = "Next"
'dg1.PagerStyle.PrevPageText = "Previous"
dg1.DataBind()
sqlconn.Close()
location for saving the file I will like to use the file dialog box in
windows. So that the user and give a name to the file and also select a
location to save it in. I then would like to grab the path and file name
information and use that to save the dataset.
PLS help I will be forever grateful.
Thanks
(e-mail address removed)
Dim strSQL As String
strSQL = "SELECT top 200 ID, STATUS,LAST_FIRST ,COMPANY FROM Name"
Dim strConn As String
strConn = "User ID=ss;pwd = 123;Initial Catalog=IMIS_PRODUCTION;Data
Source=NEITESTDB"
Dim sqlconn As New SqlConnection(strConn)
sqlconn.Open()
Dim sqlDA As New SqlDataAdapter(strSQL, sqlconn)
Dim objds As New DataSet()
sqlDA.Fill(objds, "dtnames")
objds.WriteXml("c:\imis_web_test.xls")
dg1.DataSource = objds.Tables.Item("dtnames")
'dg1.PagerStyle.NextPageText = "Next"
'dg1.PagerStyle.PrevPageText = "Previous"
dg1.DataBind()
sqlconn.Close()