Create INT Primary KEY Nvarchar Nvarchar Insert Into Values Insert Into Values
Create INT Primary KEY Nvarchar Nvarchar Insert Into Values Insert Into Values
[student]
(
[rollno] INT NOT NULL PRIMARY KEY,
[sname] NVARCHAR(50) NULL,
[course] NVARCHAR(50) NULL
)
INSERT INTO [dbo].[student] ([rollno], [sname], [course]) VALUES (1, N'murari', N'MCA')
INSERT INTO [dbo].[student] ([rollno], [sname], [course]) VALUES (2, N'krishna', N'MCA')
Imports System.Xml
Imports System.IO
Imports System.Data.SqlClient
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim writer As New XmlTextWriter("f:\students.xml", System.Text.Encoding.UTF8)
writer.WriteStartDocument(True)
writer.Formatting = Formatting.Indented
writer.Indentation = 2
writer.WriteStartElement("StudentInfo")
createNode(1, "Pinki", "85", writer)
createNode(2, "chinki", "56", writer)
createNode(3, "pankaj", "89", writer)
Try
connection.Open()
adapter = New SqlDataAdapter(sql, connection)
adapter.Fill(ds)
connection.Close()
ds.WriteXml("f:\studentdemo.xml")
DataGridView1.DataSource = ds.Tables(0)
DataGridView1.Show()
MsgBox("Done")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class