Bonjour tout le monde.
Je viens de commencer avec les web services. Donc j'ai besoin d'un web service qui vérifie les 4 premiers nombres d'un chiffre s'il existe dans une table ou pas.
J'ai 2 tables:
exemple
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 table phone ---------------------- table typeop id_phone ------------------------- id_typeop ind --------------------------------- libelle id_typeop
phone:
id_typeop:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 id_phone ------- ind ------------ id_typeop 1 --------------- 0610 ----------- 1 1 --------------- 0661 ----------- 2 1 --------------- 0611 ----------- 3 1 --------------- 0612 ----------- 4 1 --------------- 0613 ----------- 1
Donc j'aimerai bien quand je saisie dans un champs textbox un numéro, je recoi comme reponse le libelle dans correspond au 4 première chiffre à l'aide d'un web service. voila ce que j'ai fait
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 id_typeop ------------ libelle 1 ------------------- libelle1 1 ------------------- libelle2 1 ------------------- libelle3 1 ------------------- libelle4
page web service(sachant que je travaille avec access)
quand j'exécute (ctrl + f5) il y a un erreur qui me gène:
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 import system.data import system.data.oledb import system.web import system.web.services import system.web.services.protocols <webmethod()>_ public function phone(byval num as string) as dataset dim con as new oledb.oledbconnection() con.connectionstring="provider=microsoft.jet.oledb.4.0;data source=c:\database\phone.mdb;" con.open() dim ds as new dataset dim da as new oledb.oledbdataadapter da = new oledb.oledbdataadapter("select phone.id_phone, phone.ind, phone.id_typeop, typeop.libelle from ( phone inner join typeop on phone.id_typeop = typeop.id_typeop) where (phone.ind =" & num & "))", con) da.fill(ds, "tabl") con.close() return ds end function
alors si qq peut m'aider ou a une idée merci bien sinon merci bienSystem.Data.OleDb.OleDbException: ) en trop dans l'expression '(phone.ind = 0662))'.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
at Service.phone1(String num)
Partager