cs_rehab
Messages postés11Date d'inscriptionsamedi 3 novembre 2007StatutMembreDernière intervention16 juin 2009
-
21 avril 2008 à 12:16
cs_rehab
Messages postés11Date d'inscriptionsamedi 3 novembre 2007StatutMembreDernière intervention16 juin 2009
-
21 avril 2008 à 18:25
bonjour tout le monde ,j'ai un problème avec ma connection mysql avec asp.net ,ça fait une seamine que cherche la faute sur ce code:
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.ODBC" %>
<script language="VB" Runat="server">
Sub Page_Load(Source as Object, E as EventArgs)
BindData
End Sub
Sub BindData()
Dim strConn As String
strConn = "DRIVER={MySQLODBC 3.51 Driver};ServerAddress = localhost;DATABASE=hi;" & _
"USER=root;PASSWORD=; OPTION=16386;"
Dim MySQL As String = "Select * " & _
" from moi"
Dim MyConn As New ODBCConnection(strConn)
Dim ds As DataSet = New DataSet()
Dim Cmd As New ODBCDataAdapter(MySQL, MyConn)
Cmd.Fill(ds, "moi")
MyDataGrid.DataSource = ds.Tables("moi").DefaultView
MyDataGrid.DataBind()
End Sub
Sub Page_Change(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
MyDataGrid.CurrentPageIndex = e.NewPageIndex
BindData()
End Sub
</script>
cs_rehab
Messages postés11Date d'inscriptionsamedi 3 novembre 2007StatutMembreDernière intervention16 juin 2009 21 avril 2008 à 17:52
en réalité ce code me permet de récupérer tous les enregistrements de ma table "moi" mai il ne me déclare aucune faute mais ne me ré cupère rien .je pense qu'il manque quelque chose ,j'ai tous installé.aidez-moi svp.merci
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.ODBC" %>
<script language="VB" Runat="server">
Sub Page_Load(Source as Object, E as EventArgs)
BindData
End Sub
Sub BindData()
Dim nom
Dim prenom
Dim strConn As String
nom = "han"
prenom = "han"
strConn = "DRIVER={MySQLODBC 3.51 Driver};ServerAddress = localhost;DATABASE=hi;" & _
"USER=root;PASSWORD=; OPTION=16386;"
Dim MySQL As String = "INSERT INTO moi (nom,prenom) " & _
"values('" + nom + "','" + prenom + "' )"""
Dim MyConn As New OdbcConnection(strConn)
Dim ds As DataSet = New DataSet()
Dim Cmd As New OdbcDataAdapter(MySQL, MyConn)
Cmd.Fill(ds, "moi")
MyDataGrid.DataSource = ds.Tables("moi").DefaultView
MyDataGrid.DataBind()
End Sub
Sub Page_Change(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
MyDataGrid.CurrentPageIndex = e.NewPageIndex
BindData()
End Sub
</script>