rmokkenstorm Posted May 11, 2006 Posted May 11, 2006 (edited) i'm building a program wich have a search function. the user fills in a value in a textbox and presses the button. now the given value should pass to the select query string VAL; if (textBox1.Text != string.Empty) { VAL = textBox1.Text; } else { VAL = "%"; } this.dBANBM_T075_BORGTOCHTTableAdapter.Fill(this.testdb1DataSet.DBANBM_T075_BORGTOCHT); and the select query is: WHERE (T075_BORGTOCHTNUMMER_1 LIKE ?)" i use a acces database but when i execute this he says that there is no value for the paratmeter can anyone help me? Edited May 11, 2006 by PlausiblyDamp Quote
Administrators PlausiblyDamp Posted May 11, 2006 Administrators Posted May 11, 2006 You need to pass the VAL string into the query, if you are using the 2005 table adapter designer (and it looks like you are) then you can use a wizard to add a query to the adapter - give it your parameterised SQL as the source and it will generate a wrapper method that will allow you to pass the parameter in. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
rmokkenstorm Posted May 11, 2006 Author Posted May 11, 2006 I put down a new query with the select : WHERE T075_BORGTOCHTNUMMER_1 LIKE ? and the following fill command: this.dBANBM_T075_BORGTOCHTTableAdapter.FillBy1(this.testdb1DataSet.DBANBM_T075_BORGTOCHT); he return's me the error: No overload for method 'FillBy1' takes '1' arguments Quote
Administrators PlausiblyDamp Posted May 11, 2006 Administrators Posted May 11, 2006 That's because the function you just created expects you to pass in a second parameter - put VAL in there and it will use the variable as a parameter for the query. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
rmokkenstorm Posted May 11, 2006 Author Posted May 11, 2006 well then he is complaining that he cannot convert the string to decimal. Quote
Administrators PlausiblyDamp Posted May 11, 2006 Administrators Posted May 11, 2006 In that case you might want to convert the string to a decimal. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.