Insert into custom DB

Jun 5, 2014 at 9:55 AM
hi guys

I'm learning to develop sharepoint solutions, and I'm trying to create a custom service application with your template. Thanks for it :)
Can you please explain me, how I can insert a new row into the provisioned custom db (in any table)?
Should I use the ServiceApplication Class or another Class from your Kit to handle custom db querys? If yes, how I can do this? Can you please post me an code-example?

Or do I have to use the standard .NET db-handler like this:
System.Data.SqlClient.SqlConnection sqlConnection1 = new System.Data.SqlClient.SqlConnection("YOUR CONNECTION STRING");
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
cmd.CommandType = System.Data.CommandType.Text;
cmd.CommandText = "INSERT Region (RegionID, RegionDescription) VALUES (5, 'NorthWestern')";
cmd.Connection = sqlConnection1;

thanks and regards