SqlConnection1.Open() SqlCommand1.CommandText = "proc1" Try SqlCommand1.ExecuteNonQuery() Catch sqlex As SqlClient.SqlException MsgBox(sqlex.Number.ToString + " " + sqlex.Message + " ") TextBox1.Text = SqlCommand1.Parameters.Item("parameter1").Value Finally SqlConnection1.Close() End Try