Bonjour a tous,
Voila mon probleme j'essaye de me connecter a une base Sql Distant pour executer une requete de creation de table Voici mon code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
   Try
                Dim ObjetConnection As OleDbConnection
                Dim ObjetCommand As OleDbCommand
                Dim strConn As String
                Dim SQLRequette
                strConn = MA chaine de connection Testee sur une autre fonction
                ObjetConnection = New OleDbConnection
                ObjetConnection.ConnectionString = strConn
                ObjetConnection.Open()
                ObjetCommand = New OleDbCommand
                ObjetCommand.Connection = ObjetConnection
                SqlRequette = "Create Table ListeOperationMensuelle(JourDuMois Char(32),DateDebut Char(32),DateFin char(32),Compte Char(32),Libelle char(32),Montant char(32),Periodicite char(32))"
                ObjetCommand.CommandType = CommandType.Text
                ObjetCommand.CommandText = SQLRequette
                ObjetCommand.ExecuteNonQuery()
                ObjetConnection.Close()
                Return True
            Catch ex2 As Exception : MsgBox(ex2.Message)
                Return False
            End Try
Quand j'execute mon code j'ai une exeption qui me dit que la propriete ConnectionString n'a pas ete initialise.
C'est la premiere que j'utilise SQL server pour creer une table si qq un Voit l'erreur Ca m'aiderais bien!!
merci de m'avoir lu