Posted on: 6/25/2014 12:06:05 PM | Views : 408


When I execute the code below I get this error:
"Object reference not set to an instance of an object." Code:
If TextBox2.Text <> "" Then If Label5.Text <> "" Then Try connStr = "connection string works" cmdStr = "INSERT INTO [posts] ([datetime],[postee],[post]) VALUES (@datetime,@postee, @post);" Using conn As New SqlConnection(connStr) Using cmd As New SqlCommand(cmdStr, conn) conn.Open() cmd.Parameters.AddWithValue("@datetime", DateTime.Now) cmd.Parameters.AddWithValue("@postee", Label5.Text) cmd.Parameters.AddWithValue("@post", TextBox2.Text) ...

Go to the complete details ...