Paci4416 Posted January 22, 2009 Share Posted January 22, 2009 Hi, I new here i hope this the right forum to ask this question.this is my webmethod: <WebMethod> Public Function Search(aGenre as string) As DataSet ' Connection dim dbconn as new OleDbConnection _ ("Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=D:\paci\project.mdb") 'Command dim dbcom as new OleDbCommand() dbcom.CommandText="SELECT * FROM FlashInfo WHERE Genre = aGenre" dbcom.Connection=dbconn' 'DataAdapter dim gameinfo as new OleDbDataAdapter(dbcom) 'DataSet dim dsnw as DataSet = new DataSet() gameinfo.Fill(dsnw) Return dsnw End FunctionWhen i enter the value he return with a error: "No value given for one or more required parameters." "at service1.Search(String aGenre) in D:\paci\service2.asmx:line 101"When i write insted aGenre , Sport, in the CommandText the function works.But it seems that with the string thing he cant get the value.Please help. :)Thank you in avdance. Link to comment Share on other sites More sharing options...
aspnetguy Posted January 22, 2009 Share Posted January 22, 2009 try this dbcom.CommandText="SELECT * FROM FlashInfo WHERE Genre = '" & aGenre Link to comment Share on other sites More sharing options...
Paci4416 Posted January 23, 2009 Author Share Posted January 23, 2009 Now i get this error: System.Data.OleDb.OleDbException: Syntax error in string in query expression 'Genre = 'Sport'. 'Sport' is the string i enter and it's exist in the DB. Link to comment Share on other sites More sharing options...
jesh Posted January 23, 2009 Share Posted January 23, 2009 dbcom.CommandText="SELECT * FROM FlashInfo WHERE Genre = '" & aGenre & "'" Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.