Untitled
By: a guest | Apr 15th, 2010 | Syntax:
VB.NET | Size: 1.01 KB | Hits: 300 | Expires: Never
Imports System.Data.SqlClient
Module Module1
Sub Main(ByVal sArgs() As String)
Dim SQLStr As String
Dim ConnString As String
'Connstring = Server Name, Database Name, Windows Authentication
ConnString = "Data Source=MATHEW-PC\SQLEXPRESS;Initial Catalog=Test;Integrated Security=True"
SQLStr = "UPDATE RSSFEEDS SET Name = 'Google Snooze' Where RSSID = 1"
'Write to SQL
Dim SQLConn As New SqlConnection() 'The SQL Connection
Dim SQLCmd As New SqlCommand() 'The SQL Command
SQLConn.ConnectionString = ConnString 'Set the Connection String
SQLConn.Open() 'Open the connection
SQLCmd.Connection = SQLConn 'Sets the Connection to use with the SQL Command
SQLCmd.CommandText = SQLStr 'Sets the SQL String
SQLCmd.ExecuteNonQuery() 'Executes SQL Commands Non-Querys only
SQLConn.Close() 'Close the connection
SQLConn.Dispose()
Console.ReadLine()
End Sub
End Module