Object reference not set to an instance of an object.
Try connStr = "connectionstring works" cmdStr = "INSERT INTO posts (post) VALUES @post;" Using conn As New SqlConnection(connStr) Using cmd As New SqlCommand(cmdStr, conn) conn.Open() cmd.Parameters.AddWithValue("@post", TextBox2.Text) cmd.ExecuteNonQuery() conn.Close() cmd.Dispose() conn.Dispose() End Using End Using Catch ex As Exception TextBox6.Text = ex.ToString() End Try
<script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { $("#<%= TextBox2.ClientID %>").keypress(function (e) { var maxCount = 500; var strCount = $("#<%= TextBox2.ClientID %>").val().length; if (strCount < maxCount) { $("#<%= TextBox3.ClientID %>").val(strCount); $("#<%= Label4.ClientID %>").text(""); $("#<%= Button4.ClientID %>").trigger('click'); } else { e.preventDefault(); $("#<%= TextBox3.ClientID %>").val("(Over 500 Keypress Limit)"); $("#<%= Label4.ClientID %>").text("_____Click anywhere on TextBox to Edit______"); } }); }); </script>
conn.Close() cmd.Dispose() conn.Dispose()
INSERT INTO posts (post) VALUES @post;
INSERT INTO posts (post) VALUES (@post);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)