Question: As in title, I would like to see what I'm writing by input text.

There is my code:

```js
function setLogo(txtLogo){
    //edit logo by textarea
    var myLogo = $("#title-logo");
    myLogo.text(txtLogo);
}
```

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="text" id="txtLogo" onkeyup="setLogo(this)" value="Logo Text">
<h2 id="title-logo"></h2>
```

When I'm writing I can see `[object HTMLInputElement]` inside `h2` but if I'm not writing nothing I can't see nothing on it. Any ideas?

Answer: 
First you should create a connection to SQL database before executing any query. After then you should be able to insert data before updating any data into database. After you insert data successfully you can update data using above command text. Here is some sample code for inserting data for registering customer.

```
using (SqlCommand command = new SqlCommand())
{
    command.Connection = connection;            // <== lacking
    command.CommandType = CommandType.Text;
    command.CommandText = "INSERT into CustomerTbl (CustId, Name, Address) VALUES (@CustId, @Name, @Address)";
    command.Parameters.AddWithValue("@CustId", name);
    command.Parameters.AddWithValue("@Name", userId);
    command.Parameters.AddWithValue("@Address", idDepart);

    try
    {
        connection.Open();
        int recordsAffected = command.ExecuteNonQuery();
    }
    catch(SqlException)
    {
        // error here
    }
    finally
    {
        connection.Close();
    }
}

```
If you're *adding* a record, you're going to need to `INSERT`, not `UPDATE`. For example (here using ["Dapper"](https://www.nuget.org/packages/Dapper/) to do all the heavy work, including parameter handling):

```cs
using Dapper;
//...
void UpsertAddress(int? id, string address)
{
    if (id is null)
    {
        connection.Execute("insert CustomerTbl (customer_address) values (@address);",
            new { address }); // possibly using the OUTPUT clause to fetch an IDENTITY
    }
    else
    {
        connection.Execute(
            "update CustomerTbl set customer_address = @address where custID = @id;",
            new { id, address });
    }
}

```