Erreur en Web et pas en local
Bonjour,
voici mon code:
Code:
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
| Imports System.Data
Imports System.Data.OleDb
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Ouvrir(Server.MapPath("~\App_Data\user.mdb"))
ObjetCommand.CommandText = "Select [USER] FROM [User]"
Dim myREADER As OleDbDataReader = ObjetCommand.ExecuteReader()
Do While myREADER.Read()
Label2.Text = myREADER.Item(0).ToString()
Exit Do
Loop
myREADER.Close()
ObjetConnection.Close()
End Sub
End Class
Public Module BASE_ACCESS
Public ObjetConnection As OleDbConnection
Public ObjetCommand As OleDbCommand
Public ObjetDataAdapter As OleDbDataAdapter
Public ObjetDataSet As New DataSet()
Public strSql As String
Public ObjetDataTable As DataTable
Public ObjetDataRow As DataRow
Public RowNumber As Integer
Public strConn As String
Public ObjetCommandBuilder As OleDbCommandBuilder
Public Sub Ouvrir(ByVal adresse As String)
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source= " & adresse & ";"
ObjetConnection = New OleDbConnection
'Donner à la propriété ConnectionString les paramètres de connexion
ObjetConnection.ConnectionString = strConn
'Ouvrir la connexion
ObjetConnection.Open()
'Instancier un objet Commande
ObjetCommand = New OleDbCommand
ObjetCommand.Connection = ObjetConnection
ObjetCommand.CommandType = CommandType.Text
End Sub
Public Sub OuvrirCode(ByVal adresse As String, code As String)
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source= " & adresse & ";Persist Security Info=True;Jet OLEDB:Database Password=" & code & ""
ObjetConnection = New OleDbConnection
'Donner à la propriété ConnectionString les paramètres de connexion
ObjetConnection.ConnectionString = strConn
'Ouvrir la connexion
ObjetConnection.Open()
'Instancier un objet Commande
ObjetCommand = New OleDbCommand
ObjetCommand.Connection = ObjetConnection
ObjetCommand.CommandType = CommandType.Text
End Sub
End Module |
Alors en fait quand je debogage (local) le site fonctione parfaitement, le label indique correctement le nom USER.. des que je le copi sur le serveur c'est mort j'ai une page d'erreur ?
je ne comprend pas?