Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 = "INSERT into RSSFEEDS(URL, Name) VALUES('http://news.google.com', 'Google News')"
- '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
- Console.ReadLine()
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment