DataTable table = new DataTable (); SqlConnection Conn = new SqlConnection("la chaine de connexion"); string RequeteSql = String.Format("INSERT INTO TaTable VALUES ({0},{1},{2},{3},{4})",TextBoxID.Text,TextBoxNom.Text,TextBoxPreNom.Text,TextBoxAge.Text,TextBoxAdresse.Text); SqlDataAdapter Adapt = new SqlDataAdapter(RequeteSql, Conn); try { Adapt.Fill(table); } catch (Exception) { }
DataTable table = new DataTable (); SqlConnection Conn = new SqlConnection("la chaine de connexion"); string RequeteSql = "INSERT INTO TaTable VALUES (@id,@nom,@prenom,@age,@adresse)"; SqlDataAdapter Adapt = new SqlDataAdapter(RequeteSql, Conn); Adapt.InsertCommand.Parameters.Add("@id", SqlDbType.VarChar).Value = TextBoxID.Text; ... try { Adapt.Fill(table); } catch (Exception) { }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question