[Solved] How to insert a string into an sql server table via a windows form? [closed]


AddTof1(string s) 
{    
  using (SqlConnection connection = new SqlConnection(connectionString))
  {
      connection.Open();

      using (SqlCommand command = new SqlCommand("INSERT INTO table1 values(@s)", connection))
      {
          command.Parameters.AddWithValue("@s", s);
          command.ExecuteNonQuery();
      }
  }

}

Then you can call this method as;

AddTof1("hello there");

4

solved How to insert a string into an sql server table via a windows form? [closed]