amberdextrous
MIS
Hello, I have run into a problem developing a small VB 2005 application for a call center. The program runs against Microsoft SQL Server 2005. The program runs a query to pull records from one table in a database, based on the dates the user selects from DateTimePicker (which correspond to a Date column in the table. Basically, the function is "Select all calls made between date1 and date2). I do this by declaring a DataAdapter object, then I set the SelectCommand properties for Connection, CommandText, and Parameters. Then I declare a DataSet object and fill it with the data returned by the query and close the database connection. Then, I am supposed to take that data and generate an XML file with it. This is the code I have now:
The problem with this is obvious: everytime you run the query, it will overwrite the existing XML file. I want to implement a "Save As" dialog box so that when the user selects the 2 dates and hits "Execute", the query runs and a Save As dialog box pops up asking what to name the file and where to store it, and THEN have the XML file written to that name/location.
I'm very new to VB. I'm just not sure how to implement a SaveAsDialog so that it will work with automatically generating an XML file. Anyone have suggestions on how I can get my program to do what I want it to do?
Code:
' Write query results to XML file.
objDataSet.WriteXml("C:\SampleXML.xml")
The problem with this is obvious: everytime you run the query, it will overwrite the existing XML file. I want to implement a "Save As" dialog box so that when the user selects the 2 dates and hits "Execute", the query runs and a Save As dialog box pops up asking what to name the file and where to store it, and THEN have the XML file written to that name/location.
I'm very new to VB. I'm just not sure how to implement a SaveAsDialog so that it will work with automatically generating an XML file. Anyone have suggestions on how I can get my program to do what I want it to do?