Bonjour,
J'ai commencé a programmer en ASP.NET et je trouve des tuto utilisant code aspx et autre travail avec code behind.par exemple la connexion a la base je trouve comme ceci :
et dans autre tuto je trouve comme ceci :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 Sub Page_Load(sender As Object,e As EventArgs) Dim myConnection As SqlConnection Dim myReader As SqlDataReader Dim myCommand As SqlCommand myConnection = CType(Session("myConnection"),SqlConnection) myCommand = new SqlCommand("HistoriqueStock",myConnection) myCommand.CommandType = CommandType.StoredProcedure myCommand.Parameters.Add("@ProduitID",SqlDbType.Int). myCommand.Parameters("@ProduitID").Value = Request.Params("id") myReader = myCommand.ExecuteReader() myReader.Read() NomProduit.Text = myReader.GetString(4) myReader.Close()
Je sais laquelle des deux méthodes a suivre coder en code ASPX dans les page aspx ou coder en page du code behind ??
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:basedossierConnectionString %>" InsertCommand="INSERT INTO dossier(num_dossier, num_envoi_commune, num_arrivee_agence, date_arrivee_agence, observation, petitionaire, date_envoi_commun, idautre_avis, date_envoi_agance, num_envoi_agence, id_commune, code_projet, reference_fonciere, id_Archetecte, id_topographe) VALUES (@num_dossier, @num_envoi_commune, @num_arrivee_agence, @date_arrivee_agence, @observation, @petitionaire, @date_envoi_commun, @idautre_avis, @date_envoi_agance, @num_envoi_agence, @id_commune, @code_projet, @reference_fonciere, @id_Archetecte, @id_topographe)" SelectCommand="SELECT * FROM [dossier]" ProviderName="<%$ ConnectionStrings:basedossierConnectionString.ProviderName %>">
Merci de fournir d'aide.
Partager