Base access dans un web service

ManuAntibes Messages postés 491 Date d'inscription mardi 24 octobre 2000 Statut Membre Dernière intervention 18 novembre 2021 - 14 mars 2007 à 22:15
ManuAntibes Messages postés 491 Date d'inscription mardi 24 octobre 2000 Statut Membre Dernière intervention 18 novembre 2021 - 17 mars 2007 à 11:56
Salut
j'arrive a recuperer dans un dataset les données d'une base SQL ....Car j'ai suivi ce tuto
Que l'on trouve a cette adresse : http://msdn2.microsoft.com/fr-fr/library/s5xy331f(VS.80).aspx


J'y arrive très bien , mais Je souhaite faire  la même chose avec une base Access ou ODBC et là par contre j'ai une erreur que je n'arrive pas à resoudre.



System.Data.OleDb.OleDbException: Type de données incompatible dans l'expression du critère.    à System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)    à System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)    à System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)    à System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)    à System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)    à System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)    à System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)    à System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)    à System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)    à System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)    à ClassArticle.ListeDataSetArticle(Int32 mag) dans C:\Documents and Settings\manu\Mes documents\WebServiceArticle\App_Code\Service.vb:ligne 21

la ligne 21 est : custDa.Fill(custDs, "DBA_articles")


Je vous donne mon code :
Imports System.data
Imports System.Data.OleDb
Imports System.Web.Services

<WebService(Namespace:="http://tempuri.org/")> _<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
_Public Class ClassArticleInherits

Public TableArticleConn As OleDbConnection = New OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Application\DBx.mdb")

<WebMethod()>
PublicFunction ListeDataSetArticle(ByVal mag AsInteger) As DataSetDim custDa As OleDbDataAdapter New OleDbDataAdapter("SELECT [CODE_RAYON], [CODE_PLU], [CODE_EAN], [DESIGNATION], [PV1], [TVA1], [FAMILLE], [TARE] FROM [DBA_articles] WHERE CODE_RAYON'" & mag & "'", TableArticleConn)
Dim custDs As DataSet = New DataSet()
custDa.MissingSchemaAction = MissingSchemaAction.AddWithKey
custDa.Fill(custDs, "DBA_articles")
ListeDataSetArticle = custDsEndFunctionEndClass


Merci  de m'aider

MANUANTIBES [:p]

3 réponses

SuperBouly Messages postés 410 Date d'inscription dimanche 1 février 2004 Statut Membre Dernière intervention 8 mai 2010
17 mars 2007 à 10:41
bonjour,
Peut_être que l'expression
WHERE CODE_RAYON ='" & mag & "'"  doit être WHERE CODE_RAYON ='" & mag & "'etc suite du string 

les strings sont entourés d'apostrophes, pas les integer
@+Gilles
0
SuperBouly Messages postés 410 Date d'inscription dimanche 1 février 2004 Statut Membre Dernière intervention 8 mai 2010
17 mars 2007 à 10:41
bonjour,
Peut_être que l'expression
WHERE CODE_RAYON ='" & mag & "'"  doit être WHERE CODE_RAYON ='" & mag & "'etc suite du string 

les strings sont entourés d'apostrophes, pas les integer
@+Gilles
0
ManuAntibes Messages postés 491 Date d'inscription mardi 24 octobre 2000 Statut Membre Dernière intervention 18 novembre 2021 5
17 mars 2007 à 11:56
en faite sur un autre forum on m'a donné la reponseDim custDa As OleDbDataAdapter New OleDbDataAdapter("SELECT [CODE_RAYON], [CODE_PLU], [CODE_EAN], [DESIGNATION], [PV1], [TVA1], [FAMILLE], [TARE] FROM [DBA_articles] WHERE CODE_RAYON " +  mag.ToString, TableArticleConn)

mais je testerais le coup des apostrophes

En tous cas merci
Tu t'y connais en IIS car j'ai posté une question sur IIS 5.1.
encore merci @+

MANUANTIBES [:p]
0
Rejoignez-nous