hi i need to save rss to sql
every day first load read and write sql and other read from my db

Imports System.ServiceModel.Syndication
Imports System.Xml
Imports System.Data
Imports System.Data.SqlClient

Partial Class _Example4
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim RSSReader As XmlReader = XmlReader.Create(ConfigurationManager.AppSettings("rssUri"))
        Dim formatter As New Rss20FeedFormatter()
        lblTitle.Text = formatter.Feed.Title.Text
        lblDescription.Text = formatter.Feed.Description.Text
        hlRss.NavigateUrl = formatter.Feed.Links(0).Uri.AbsoluteUri
        lvRSS.DataSource = formatter.Feed.Items

        Dim systime As DateTime
        systime = DateTime.Today()

        Dim connect As SqlConnection
        Dim command As SqlCommand
        Dim query As String
        connect = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\admin\Documents\RssFeed.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")
        query = "insert into RSS values(@title,@link,@description)"

        For Each Items As ListViewItem In lvRSS.Items
            command = New SqlCommand(query, connect)
            command.Parameters.AddWithValue("@title", formatter.Feed.Title.Text)
            command.Parameters.AddWithValue("@link", formatter.Feed.Links(0).Uri.AbsoluteUri)
            command.Parameters.AddWithValue("@description", formatter.Feed.Description.Text)

        If command.ExecuteNonQuery() Then
            lblmsg.Text = "save"
            lblmsg.Text = "not save"
        End If

    End Sub

End Class

Is the code throwing an exceptions?

From a first glace perspective, we can't tell if it has errors or not.

Have you looked into Try/Catch blocks?

Place your code in them and give a MsgBox for output:

    'Paste your code here
Catch ex As Exception
End Try
This article has been dead for over six months. Start a new discussion instead.