1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
   |  
 
using System.Data.SqlClient; 
using System.Text.RegularExpressions;  
 
public partial class nouvel_arrivant : System.Web.UI.Page
{
 
 
 
        public void bdd()
        {          
  try
            {
                // Chaîne de connexion contenant les informations de connexion 
 
                string myInsertQuery = "INSERT INTO [salaries] ([nom], [prenom], [adresse], [codepost], [ville], [telfixe], [telport], [mail_ajilon], [telpro]) VALUES (@nom, @prenom, @adresse, @codepost, @ville, @telfixe, @telport, @mail_ajilon, @telpro)"; 
                SqlConnection myConnection = new SqlConnection("Provider=SQLDB;Data Source=d:\\profiles\\system\\Mes documents\\Visual Studio*2005\\WebSites\\Admin\\App_Data\\intranet.mdf" ); SqlCommand myCommand = new SqlCommand(myInsertQuery, myConnection);
                myCommand.Connection.Open(); 
                myCommand.ExecuteNonQuery(); 
                myConnection.Close();
                info.Text = "Ok";
            }
            catch (Exception ex) // Récuperation des erreurs éventuelles.
            {
                info.Text = ex.ToString();
 
            }
        }
 
etc...... la suite fonctionne | 
Partager