sjchin Posted March 22, 2003 Posted March 22, 2003 Hi guy, I am fresh in VB.net. May i know how to execute SQL string in VB.NET to MsSQL ? Normally what i did in VB6 is using Connection.Execute "insert into table values ...', so how about in VB.NET? The SQL String maybe in Insert,Update or delete. Thanks and wait for prompts reply. Quote
*Gurus* Derek Stone Posted March 22, 2003 *Gurus* Posted March 22, 2003 Dim oConnection As SqlConnection = New SqlConnection("[ Connection string ]") Dim oCommand As SqlCommand = New SqlCommand("DELETE FROM Make sure to import System.Data.SqlClient when you use this code. Quote Posting Guidelines
sjchin Posted March 23, 2003 Author Posted March 23, 2003 Derek Stone, Thanks, It help for me very much . Clear in mind. Beside this, May i know if we have 3 button of insert, update and delete in a same form, when user click on each 1 will do different transaction, may i know do i need to open SqlConnection when i start load my form and close on exit, or when i do a transaction just open the SqlConnection and close when the transaction is finish ? Which 1 is faster and preferable ? Thanks and wait for prompts reply. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.