Hi Robin,
RobinS said:
Although I've read this at least a dozen times, I'm still confused.
The form you're talking about is in VS2005, not in Access, right?
Access is just your back-end data source.
That's right.
So you have a Windows Form (?) with a textbox on it where the user is
going to put in search criteria, like "bro" for "bro*" (e.g. Brown).
Yes, it's a Windows Form, I dragged a textbox on it.
I'm not sure how you added the query you're talking about. This doesn't
sound right for Visual Studio. You clicked on the Data Menu -- what did
you add? A new Data Source that is a query? Is this like a stored
procedure? It's a query definition in Access?
Because it looks like you're trying to do some kind of stored
procedure, in which case it should accept a parameter, and you should
pass the parameter.
I'm working with VS2005. I had put a textbox bounded from datasource
and, clicking on it, the Data menu was showing a "Add query" item. But
it doesn't work and it gave me the
"Too many arguments for Public Overridable Overloads Function
FillByNome(dataTable As demoDataSet.tblPatientsDataTable) As Integer".
So forget it.
Then I tried a second option: right click to TableAdapter icon, Add
query, and using the query wizard, I wrote this:
SELECT * FROM tblPatients WHERE Nome LIKE Nome + '*'
Next, I gave a name to the query, "FillByNome", and a name to the
DataTable, "GetDataBy".
It added a ToolStripButton on my form called
"FillByNomeToolStripButton". Then, on the same toolstrip, using the "Add
items" button close to the button just created, I added a textbox,
called "ToolStripTextBox"; then I run the application, I see all my
records in a DataGridView contol in my Form, and when I fill the textbox
with "bro", and clicked on the button, the entire collection of records
showing names disappears. So the query doesn't work.
Then, I changed the query by right-clicking "Configure" on the query
name in the tblPatients in DataSet designer, and changed as it:
SELECT * FROM tblPatients WHERE (Nome LIKE [@WriteNome] + '%')
The result is that I get an error message like this (I'm sorry but I
translate the message to english, so it probably it doesn't appear
exactly as is):
"No needed value specified for some parameters". I also tried this:
SELECT * FROM tblPatients WHERE (Nome LIKE [@WriteNome] + '*'), getting
the same result. If I remove the square brackets I get an SQL syntax
error. I understand that I must pass a parameter to my query, but I
can't understand how; I think it's an Access issue, but at this point
I'm not really sure about nothing.
Thanks for your patience.
Max
Please give us more specifics.
Robin S.
---------------------------------------------------------------
I repost this, with the actual column names:
I have an Access2003 db; in my form I have a textbox; on it, click on
data menu,
added a new query, gave it a name and put it in query text:
SELECT * FROM tblPatients WHERE nome LIKE nome + '*' (I'm not really
sure it's the
right syntax for querying an access db).
Closing the form, it adds a search button and a FillByNomeToolStrip
object.
My target is to write a partial text in the textbox, clilck to the
button
just created, and get all the names that start for my partial text,
ie: I
type just "bro" to get all the names starting from "bro" (brown,
browns,
brother etc.). It sounds very simple. Using the SELECT instruction
above,
and start compiling app, I get this:
"Too many arguments for "Public Overridable Overloads Function
FillByNome(dataTable As demoDataSet.tblPatientsDataTable) As Integer"
Here is the autogenerated vb code about the fill statement:
Private Sub FillByNomeToolStripButton_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
FillByNomeToolStripButton.Click
Try
Me.tblPatientsAdapter.FillByNome(Me.demoDataSet.tblPatients,
NomeToolStripTextBox.Text)
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub
I just need to get the result as indicated. I welcome any other
methos, if
it exists. I'm trying to use designer for most of the job in vb
programming.
Probably it's not the best method...
Thanks.
"Paul Clement" <
[email protected]> ha scritto
nel messaggio
¤
¤ Name is just 'something'. In my vb code it's 'Nome'.
¤
Unless you post the exact statement, including the actual column
names you are using, it will be
very difficult to troubleshoot the problem.
Paul
~~~~
Microsoft MVP (Visual Basic)