Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As aKzen said the error message is probably because you are trying to insert something which is too long to fit in one of your fields.</p> <p>I just thought I would add to this some pointers as I would assume you are still learning etc. If you use stored procedures you could cut down your code a lot, and also increase the efficiency of your application.</p> <p>Stored Procedures give you a few benefits, they are more secure as you are not transmitting query across the network (if someone intercepts your query they can gain knowledge about your table structure) Also Stored procedures do not have to be recompiled every time they are executed unlike passing a query string where the server has to compile the query each time it receives it. Also using a SP lets you reuse the same query in multiple places without having to copy paste your queryString.</p> <p>Below is the way I would approach writing the code.</p> <pre><code>' Declare a new command Dim cmd As New SqlCommand ' Set the type to Stored Proc and Tell it which connection to use cmd.CommandType = CommandType.StoredProcedure cmd.CommandText = "spMySpNameGoesHERE" cmd.Connection = con ' Add the parameter and its value cmd.Parameters.AddWithValue("@ParamName",TxtInstID.Text ) ' More Params go here cmd.ExecuteNonQuery() con.Close() CREATE PROCEDURE spMySpNameGoesHERE ( @inst_id INT, @inst_name VARCHAR(50), etc etc ) AS BEGIN Insert into Instructors Values(@inst_id, @inst_name, @contact, @game, 'N/A', 'N/A', 'Available') END </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload