Home Submit Snippets Cy2Online.Net  
Ads by Lake Quincy Media
 
 
 
View Snippet
VB.Net Database DataTable To XML
Viewed: 177
Date: 2010-01-29
This code snippet shows how to create an XML file from a DataTable object using the SqlDataAdapter class and the DataTable class.
View Snippet
Imports System.Data.SqlClient
 
 
Module Module1
 
    Sub Main()
 
        Dim server As String = ""
        Dim sqlCon As New SqlConnection("Data Source=" + server + ";Integrated Security=True")
        sqlCon.Open()
        Dim sqlCmd As New SqlCommand("SELECT * FROM Employees", sqlCon)
        Dim sqlAdapter As New SqlDataAdapter(sqlCmd)
        Dim dTable As New DataTable("Employees")
        sqlAdapter.Fill(dTable)
        dTable.WriteXml("Employees.xml")
 
        Console.ReadKey()
 
    End Sub
New Snippets
Title Language Category Views
Edit TreeNode Example 1 C# Controls 347
Multiple Insert With One Query SQL - MySQL Insert 143
Read Image File As Bytes Visual C++ File Manipulation 157
TcpClient PortScanner Visual C++ Network 78
TcpClient Example Visual C++ Network 109
Managed And Unmanaged Example Visual C++ Miscellaneous 69
XmlDocument Example Visual C++ XML 120
Reading A CSV File Visual C++ File Manipulation 153
StreamWriter Example Visual C++ File Manipulation 149
StreamReader Example Visual C++ File Manipulation 179
Edit GridView And Save Changes ASP.Net - C# Controls 265
GridView From DataTable ASP.Net - C# Controls 213
Radial Gradient Circle Example 2 VB.Net Graphics 143
Radial Gradient Circle Example 1 VB.Net Graphics 142
Check If User Is Administrator VB.Net Security 209
Encrypt Text Using TripleDESCryptoServiceProvider VB.Net Security 135
Hash Text Using SHA1Managed VB.Net Security 115
CrystalReportViewer Example VB.Net Controls 221
Drag Drop Image File Onto Form VB.Net Controls 227
Drag Drop A File Into TextBox VB.Net Controls 216
PrintPreviewControl Example VB.Net Controls 277
Nested DataRelation VB.Net Database 90
Play System Sound VB.Net Multimedia 155
Play Wav File VB.Net Multimedia 137
Semi Transparent Panel VB.Net Controls 206
Serialize Class To XML VB.Net File Manipulation 180
Get Hidden Files In Directory VB.Net File Manipulation 131
Simple PrintDocument Example VB.Net Controls 359
Reflection Example 1 VB.Net Miscellaneous 117
Insert Image Into RichTextBox VB.Net Controls 355
Show Image With Watermark VB.Net Graphics 162
Get Memory Information VB.Net File Manipulation 154
Get Runing Processes VB.Net Miscellaneous 100
FileSystemWatcher Example 1 VB.Net File Manipulation 178
DataTable To XML VB.Net Database 178
SqlDataReader To XML VB.Net Database 204
UDP File Transfer Example VB.Net Network 335
UDP Server Example VB.Net Network 288
UDP Client Example VB.Net Network 238
Read XML File From Web Server VB.Net Network 346
Ads by Lake Quincy Media
Top Snippets
Semi Transparent Panel - C#
This snippet shows how to develop a custom panel which is semi transparent by overriding CreateParams and the OnPaint method of the Panel control.
Get File Path - C#
TThis code snippet gets the filename and path of a selected file using the FileOpenDialog Class.
Add Items To ListView Control - C#
This snippet adds items to a listview control. It loops through the files in the C:\ drive and displays the filename in the listview control.
Encrypt Text Using TripleDESCryptoServiceProvider - C#
This snippet uses the TripleDESCryptoServiceProvider Class to encrypt a string and save it to a text file. The key to decrypt the file is also saved into a seperate text file.
Read Image File As bytes - C#
This sinppet opens an image for reading as bytes. The bytes are then placed into a memorystream which is used to create a bitmap image of the bytes. The image is then set as the forms background image.
Check If File Exists - C#
This snippet checks to see if a file exists using the FileInfo Class.
Get Filename Using OpenFileDialog - C#
This code snippet gets the filename of a selected file from the Open File Dialog and displays it in a message box.
Get IP Address - C#
This code snippet will get the computers IP address.
Connect To SQLServer - C#
This simple snippet creates a connection to an SQLServer.
Simple Editable Table Columns - Javascript
This snippet allows you to edit the cells of a table.