End Google Ads 201810 - BS.net 01 --> What I'm trying to do is insert a new record into a SQL Server 2008 database file.

So far the samples I have fount don't work. Does any one know how to do this. Below is one of that samples I did fine.


string UserConnection = Properties.Settings.Default.UsersConnectionString;
SqlConnection MyConnection = new SqlConnection(UserConnection);

MyConnection.Open();




String MyString = @"INSERT INTO UserData (Name, telnetaddr) VALUES('addr.name', 'addr.telnetaddr')";
SqlCommand MyCmd = new SqlCommand(MyString, MyConnection);

MyCmd.ExecuteScalar();
MyConnection.Close();
RMDoor.WriteLn("New Entry Added");

}
catch(SqlException e)
{
RMDoor.WriteLn(e.Message.ToString());
}