473,395 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

File Systesm Object

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

to****@hotmail.com

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()
Nov 19 '05 #1
2 791
Use the System.Windows.Forms.SaveFileDialog for that purpose.

"Edward F" <Ed*****@discussions.microsoft.com> wrote in message
news:3F**********************************@microsof t.com...
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

to****@hotmail.com

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()

Nov 19 '05 #2
Oups, this is for Windows only. Sorry for the confusion.

hehehe

"Michel Prévost" <mi****************************@cactuscommerce.com > wrote
in message news:eu**************@TK2MSFTNGP10.phx.gbl...
Use the System.Windows.Forms.SaveFileDialog for that purpose.

"Edward F" <Ed*****@discussions.microsoft.com> wrote in message
news:3F**********************************@microsof t.com...
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

to****@hotmail.com

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()


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: A_StClaire_ | last post by:
hi, I'm working on a project spanning five .cpp files. each file was used to define a class. the first has my Main and an #include for each of the other files. problem is my third file...
14
by: vince | last post by:
Can I add (append) to an xml file that already contains a serialized object, and be able to deserialize to either or both objects from the same file...??? How is this done...?? thanks, vince
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
6
by: Don | last post by:
I'm having problems working with a streamwriter object. After closing the streamwriter and setting it to Nothing, I try to delete the file it was writing to, but I always get the following error...
14
by: vunet.us | last post by:
Hi, I would like to use flat file data storage instead of database. Since I am new to it, I am wondering: What text file extension is a safe one to store my data online and how cost- and...
3
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
7
by: MisterPete | last post by:
How can I inherit from file but stil create an instance that writes to stdout? ----------- I'm writing a file-like object that has verbosity options (among some other things). I know I could just...
19
by: Lee Crabtree | last post by:
Is there a class in the framework that allows me read text from a file in an unbuffered manner? That is, I'd like to be able to read lines in the same manner as StreamReader.ReadLine(), but I also...
4
by: MikeJ | last post by:
make a While loop ofs = TextFileServer("somefile") string srow while (ofs=false) { srow=ofs.getRow(); Console.Writeline(srow); }
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.