Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void Main(string[] args)
- {
- string cadenaConexion = "Data Source = localhost;Initial Catalog = CLIENTE ; Integrated Security = true;";
- try
- {
- using (SqlConnection cn = new SqlConnection(datosConexion))
- {
- //Paso 2 - Abrir la conexión
- con.Open();
- string SENTENCIA = "INSERT INTO TABLA (ID, NOMBRE)VALUES (1,'ENRIQUE');";
- SqlCommand cmd = new SqlCommand(SENTENCIA, cn);
- try
- {
- cmd.ExecuteNonQuery();
- }
- catch (SqlException e)
- {
- Console.WriteLine(e.Message);
- }
- }
- }
- catch (Exception e)
- {
- Console.WriteLine(e.Message);
- }
- Console.ReadKey();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement