Is this the best way to use Intert Into.http://forums.asp.net/t/1798238.aspx/1?Is+this+the+best+way+to+use+Intert+Into+Mon, 30 Apr 2012 05:15:16 -040017982384957124http://forums.asp.net/p/1798238/4957124.aspx/1?Is+this+the+best+way+to+use+Intert+Into+Is this the best way to use Intert Into. <p>Hi.</p> <p>Im using this code, i want to know is it the best way to insert data into a db and do i miss something so its running better !?</p> <pre class="prettyprint">Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim strSQL As String = &quot;&quot; strSQL = &quot;&quot; &amp; _ &quot;INSERT INTO news_users &quot; &amp; _ &quot;(newsuser_name, newsuser_mail, newsuser_gen, newsuser_dob, newsuser_status, newsuser_add, newsuser_city, newsuser_zip) &quot; &amp; _ &quot;VALUES (?,?,?,?,?,?,?,?)&quot; Using connection As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings(&quot;MasterConnStr&quot;).ConnectionString) Using insertcmd As OleDbCommand = New OleDbCommand(strSQL, connection) insertcmd.CommandType = CommandType.Text insertcmd.Parameters.AddWithValue(&quot;newsuser_name&quot;, addedmailnametext.Text) insertcmd.Parameters.AddWithValue(&quot;newsuser_mail&quot;, addedemailtext.Text) insertcmd.Parameters.AddWithValue(&quot;newsuser_gen&quot;, gen.Text) insertcmd.Parameters.AddWithValue(&quot;newsuser_dob&quot;, dobd.Text - dobm.Text - doby.Text) insertcmd.Parameters.AddWithValue(&quot;newsuser_status&quot;, 0) insertcmd.Parameters.AddWithValue(&quot;newsuser_add&quot;, Now.ToShortDateString) insertcmd.Parameters.AddWithValue(&quot;newsuser_city&quot;, addedmailcitytext.Text) insertcmd.Parameters.AddWithValue(&quot;newsuser_zip&quot;, addedmailzip.Text) insertcmd.Connection.Open() insertcmd.ExecuteNonQuery() End Using End Using End Sub</pre> <p><br> <br> </p> 2012-04-29T18:43:39-04:004957356http://forums.asp.net/p/1798238/4957356.aspx/1?Re+Is+this+the+best+way+to+use+Intert+Into+Re: Is this the best way to use Intert Into. <p>if you want to insert one record then your code is well</p> <p>but if u want to insert multipal record at a time then you use bulk insert statement&nbsp; </p> <p></p> 2012-04-30T04:15:03-04:004957402http://forums.asp.net/p/1798238/4957402.aspx/1?Re+Is+this+the+best+way+to+use+Intert+Into+Re: Is this the best way to use Intert Into. <p>Yes - you appear to be following best practices. You are ensuring that your connection is closed and disposed with the Using statement, and you are using parameters to protect against SQL protection.</p> <p>One change - I would use the Date() function in Access to generate the current date instead of doing it in VB.</p> 2012-04-30T05:15:16-04:00