|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Queries to an Access db from vs2005Hello,
I just have a form in which there's a textbox for queries. I need to use the SQL statements for an Access db, like this, which works fine in a SQL db: SELECT * FROM table WHERE name LIKE @name + '%' I just need to query the db to find names that start with letters I digit in the textbox. This query comes from dataset designer. If I use it in my Access db I get a syntax error from framework. Which is the Access equivalent? Thanks. Max The wildcard character in Jet-SQL (Access) is * and not %
That should do it Sagi Shkedy http://Blog.shkedy.com Show quote "Max" <nobody@devnull.spamcop.net> wrote in message news:45b54784$0$7735$5fc30a8@news.tiscali.it... > Hello, > I just have a form in which there's a textbox for queries. I need to use > the SQL statements for an Access db, like this, which works fine in a SQL > db: > SELECT * FROM table WHERE name LIKE @name + '%' > I just need to query the db to find names that start with letters I digit > in the textbox. > This query comes from dataset designer. If I use it in my Access db I get > a syntax error from framework. Which is the Access equivalent? > Thanks. > Max > > If I do that:
SELECT * FROM table WHERE name LIKE name + '*' I get an error when starting compiling application: "Too many arguments for "Public Overridable Overloads Function FillByName(dataTable As demoDataSet.myTableDataTable) As Integer". It reminds in a VB line: "Me.MyTableTableAdapter.FillByName(Me.demoDataSet.myTable, NameToolStripTextBox.Text)", in which the error is underlined on "NameToolStripTextBox.Text". This is the textbox where I digit the items to search for in my db. Help would be appreciated. Thanks. Show quote "Shkedy" <shkedy@newsgroups.nospam> ha scritto nel messaggio news:Og9IhOoPHHA.1248@TK2MSFTNGP03.phx.gbl... > > The wildcard character in Jet-SQL (Access) is * and not % > That should do it > > Sagi Shkedy > http://Blog.shkedy.com > "Max" <nobody@devnull.spamcop.net> wrote in message > news:45b54784$0$7735$5fc30a8@news.tiscali.it... >> Hello, >> I just have a form in which there's a textbox for queries. I need to use >> the SQL statements for an Access db, like this, which works fine in a SQL >> db: >> SELECT * FROM table WHERE name LIKE @name + '%' >> I just need to query the db to find names that start with letters I digit >> in the textbox. >> This query comes from dataset designer. If I use it in my Access db I get >> a syntax error from framework. Which is the Access equivalent? >> Thanks. >> Max >> >> > > > Can you post your code, or a small subset of the code
showing the query stuff? Robin S. ------------------ Show quote "max" <m**@max.max> wrote in message news:ARpth.18500$bH4.6269@tornado.fastwebnet.it... > > If I do that: > SELECT * FROM table WHERE name LIKE name + '*' > > I get an error when starting compiling application: > "Too many arguments for "Public Overridable Overloads Function > FillByName(dataTable As demoDataSet.myTableDataTable) As Integer". > It reminds in a VB line: > "Me.MyTableTableAdapter.FillByName(Me.demoDataSet.myTable, > NameToolStripTextBox.Text)", > in which the error is underlined on "NameToolStripTextBox.Text". This > is the textbox where I digit the items to search for in my db. > > Help would be appreciated. > Thanks. > > > "Shkedy" <shkedy@newsgroups.nospam> ha scritto nel messaggio > news:Og9IhOoPHHA.1248@TK2MSFTNGP03.phx.gbl... >> >> The wildcard character in Jet-SQL (Access) is * and not % >> That should do it >> >> Sagi Shkedy >> http://Blog.shkedy.com >> "Max" <nobody@devnull.spamcop.net> wrote in message >> news:45b54784$0$7735$5fc30a8@news.tiscali.it... >>> Hello, >>> I just have a form in which there's a textbox for queries. I need to >>> use the SQL statements for an Access db, like this, which works fine >>> in a SQL db: >>> SELECT * FROM table WHERE name LIKE @name + '%' >>> I just need to query the db to find names that start with letters I >>> digit in the textbox. >>> This query comes from dataset designer. If I use it in my Access db >>> I get a syntax error from framework. Which is the Access equivalent? >>> Thanks. >>> Max >>> >>> >> >> >> > > > Hi Robin,
I have an access 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 table WHERE name LIKE name + '*' (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 FillByNameToolStrip 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 FillByName(dataTable As demoDataSet.myTableDataTable) As Integer" Here is the autogenerated vb code about the fill statement: Private Sub FillByNameToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FillByNameToolStripButton.Click Try Me.MyTableAdapter.FillByName(Me.demoDataSet.MyTable, NameToolStripTextBox.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. Show quote "RobinS" <RobinS@NoSpam.yah.none> ha scritto nel messaggio news:s9udncmBQpYeAyrYnZ2dnUVZ_r-onZ2d@comcast.com... > > Can you post your code, or a small subset of the code > showing the query stuff? > > Robin S. > ------------------ > "max" <m**@max.max> wrote in message > news:ARpth.18500$bH4.6269@tornado.fastwebnet.it... >> >> If I do that: >> SELECT * FROM table WHERE name LIKE name + '*' >> >> I get an error when starting compiling application: >> "Too many arguments for "Public Overridable Overloads Function >> FillByName(dataTable As demoDataSet.myTableDataTable) As Integer". >> It reminds in a VB line: >> "Me.MyTableTableAdapter.FillByName(Me.demoDataSet.myTable, >> NameToolStripTextBox.Text)", >> in which the error is underlined on "NameToolStripTextBox.Text". This is >> the textbox where I digit the items to search for in my db. >> >> Help would be appreciated. >> Thanks. >> >> >> "Shkedy" <shkedy@newsgroups.nospam> ha scritto nel messaggio >> news:Og9IhOoPHHA.1248@TK2MSFTNGP03.phx.gbl... >>> >>> The wildcard character in Jet-SQL (Access) is * and not % >>> That should do it >>> >>> Sagi Shkedy >>> http://Blog.shkedy.com >>> "Max" <nobody@devnull.spamcop.net> wrote in message >>> news:45b54784$0$7735$5fc30a8@news.tiscali.it... >>>> Hello, >>>> I just have a form in which there's a textbox for queries. I need to >>>> use the SQL statements for an Access db, like this, which works fine in >>>> a SQL db: >>>> SELECT * FROM table WHERE name LIKE @name + '%' >>>> I just need to query the db to find names that start with letters I >>>> digit in the textbox. >>>> This query comes from dataset designer. If I use it in my Access db I >>>> get a syntax error from framework. Which is the Access equivalent? >>>> Thanks. >>>> Max >>>> >>>> >>> >>> >>> >> >> >> > > > Hi,
"max" <m**@max.max> wrote in message Try:news:Qk%th.21862$bH4.13666@tornado.fastwebnet.it... > > Hi Robin, > I have an access 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 table WHERE name LIKE name + '*' (I'm not really sure it's > the right syntax for querying an access db). SELECT * FROM table WHERE [name] LIKE ? + '%' JET uses unnamed parameters (?) and % as wildcards. HTH, Greetings Show quote > Closing the form, it adds a search button and a FillByNameToolStrip > 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 > FillByName(dataTable As demoDataSet.myTableDataTable) As Integer" > > Here is the autogenerated vb code about the fill statement: > > Private Sub FillByNameToolStripButton_Click(ByVal sender As > System.Object, ByVal e As System.EventArgs) Handles > FillByNameToolStripButton.Click > Try > Me.MyTableAdapter.FillByName(Me.demoDataSet.MyTable, > NameToolStripTextBox.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. > > "RobinS" <RobinS@NoSpam.yah.none> ha scritto nel messaggio > news:s9udncmBQpYeAyrYnZ2dnUVZ_r-onZ2d@comcast.com... >> >> Can you post your code, or a small subset of the code >> showing the query stuff? >> >> Robin S. >> ------------------ >> "max" <m**@max.max> wrote in message >> news:ARpth.18500$bH4.6269@tornado.fastwebnet.it... >>> >>> If I do that: >>> SELECT * FROM table WHERE name LIKE name + '*' >>> >>> I get an error when starting compiling application: >>> "Too many arguments for "Public Overridable Overloads Function >>> FillByName(dataTable As demoDataSet.myTableDataTable) As Integer". >>> It reminds in a VB line: >>> "Me.MyTableTableAdapter.FillByName(Me.demoDataSet.myTable, >>> NameToolStripTextBox.Text)", >>> in which the error is underlined on "NameToolStripTextBox.Text". This is >>> the textbox where I digit the items to search for in my db. >>> >>> Help would be appreciated. >>> Thanks. >>> >>> >>> "Shkedy" <shkedy@newsgroups.nospam> ha scritto nel messaggio >>> news:Og9IhOoPHHA.1248@TK2MSFTNGP03.phx.gbl... >>>> >>>> The wildcard character in Jet-SQL (Access) is * and not % >>>> That should do it >>>> >>>> Sagi Shkedy >>>> http://Blog.shkedy.com >>>> "Max" <nobody@devnull.spamcop.net> wrote in message >>>> news:45b54784$0$7735$5fc30a8@news.tiscali.it... >>>>> Hello, >>>>> I just have a form in which there's a textbox for queries. I need to >>>>> use the SQL statements for an Access db, like this, which works fine >>>>> in a SQL db: >>>>> SELECT * FROM table WHERE name LIKE @name + '%' >>>>> I just need to query the db to find names that start with letters I >>>>> digit in the textbox. >>>>> This query comes from dataset designer. If I use it in my Access db I >>>>> get a syntax error from framework. Which is the Access equivalent? >>>>> Thanks. >>>>> Max >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> >> >> >> > > > Hi,
Show quote "Bart Mermuys" <bmermuys.nospam@hotmail.com> ha scritto nel messaggio It works fine!news:90svh.316241$oW6.6302842@phobos.telenet-ops.be... > > Hi, > > "max" <m**@max.max> wrote in message > news:Qk%th.21862$bH4.13666@tornado.fastwebnet.it... >> >> Hi Robin, >> I have an access 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 table WHERE name LIKE name + '*' (I'm not really sure it's >> the right syntax for querying an access db). > > Try: > > SELECT * FROM table WHERE [name] LIKE ? + '%' > > JET uses unnamed parameters (?) and % as wildcards. > > HTH, > Greetings I just add a query from the TableAdapter Icon using the query wizard, paste the code you wrote, then designer adds a button and a textbox, and I wrote on it just some digit to get the results I was expecting! It was an Access issue. I didn't expect it was so hard to work with Access db in VS2005, I find only sql samples in internet... Do you know a place where I can learn more about SQL statements for Access db in a VS2005 environment? Thanks a lot Bart!!! Max. Show quote > >> Closing the form, it adds a search button and a FillByNameToolStrip >> 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 >> FillByName(dataTable As demoDataSet.myTableDataTable) As Integer" >> >> Here is the autogenerated vb code about the fill statement: >> >> Private Sub FillByNameToolStripButton_Click(ByVal sender As >> System.Object, ByVal e As System.EventArgs) Handles >> FillByNameToolStripButton.Click >> Try >> Me.MyTableAdapter.FillByName(Me.demoDataSet.MyTable, >> NameToolStripTextBox.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. >> >> "RobinS" <RobinS@NoSpam.yah.none> ha scritto nel messaggio >> news:s9udncmBQpYeAyrYnZ2dnUVZ_r-onZ2d@comcast.com... >>> >>> Can you post your code, or a small subset of the code >>> showing the query stuff? >>> >>> Robin S. >>> ------------------ >>> "max" <m**@max.max> wrote in message >>> news:ARpth.18500$bH4.6269@tornado.fastwebnet.it... >>>> >>>> If I do that: >>>> SELECT * FROM table WHERE name LIKE name + '*' >>>> >>>> I get an error when starting compiling application: >>>> "Too many arguments for "Public Overridable Overloads Function >>>> FillByName(dataTable As demoDataSet.myTableDataTable) As Integer". >>>> It reminds in a VB line: >>>> "Me.MyTableTableAdapter.FillByName(Me.demoDataSet.myTable, >>>> NameToolStripTextBox.Text)", >>>> in which the error is underlined on "NameToolStripTextBox.Text". This >>>> is the textbox where I digit the items to search for in my db. >>>> >>>> Help would be appreciated. >>>> Thanks. >>>> >>>> >>>> "Shkedy" <shkedy@newsgroups.nospam> ha scritto nel messaggio >>>> news:Og9IhOoPHHA.1248@TK2MSFTNGP03.phx.gbl... >>>>> >>>>> The wildcard character in Jet-SQL (Access) is * and not % >>>>> That should do it >>>>> >>>>> Sagi Shkedy >>>>> http://Blog.shkedy.com >>>>> "Max" <nobody@devnull.spamcop.net> wrote in message >>>>> news:45b54784$0$7735$5fc30a8@news.tiscali.it... >>>>>> Hello, >>>>>> I just have a form in which there's a textbox for queries. I need to >>>>>> use the SQL statements for an Access db, like this, which works fine >>>>>> in a SQL db: >>>>>> SELECT * FROM table WHERE name LIKE @name + '%' >>>>>> I just need to query the db to find names that start with letters I >>>>>> digit in the textbox. >>>>>> This query comes from dataset designer. If I use it in my Access db I >>>>>> get a syntax error from framework. Which is the Access equivalent? >>>>>> Thanks. >>>>>> Max >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> >> >> >> > > > Hi,
Show quote "max" <m**@max.max> wrote in message Sorry for the late reply, but unfortunately i don't know such place. But news:qxIvh.31410$bH4.4926@tornado.fastwebnet.it... > > Hi, > > "Bart Mermuys" <bmermuys.nospam@hotmail.com> ha scritto nel messaggio > news:90svh.316241$oW6.6302842@phobos.telenet-ops.be... >> >> Hi, >> >> "max" <m**@max.max> wrote in message >> news:Qk%th.21862$bH4.13666@tornado.fastwebnet.it... >>> >>> Hi Robin, >>> I have an access 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 table WHERE name LIKE name + '*' (I'm not really sure it's >>> the right syntax for querying an access db). >> >> Try: >> >> SELECT * FROM table WHERE [name] LIKE ? + '%' >> >> JET uses unnamed parameters (?) and % as wildcards. >> >> HTH, >> Greetings > > It works fine! > I just add a query from the TableAdapter Icon using the query wizard, > paste the code you wrote, then designer adds a button and a textbox, and I > wrote on it just some digit to get the results I was expecting! > It was an Access issue. I didn't expect it was so hard to work with Access > db in VS2005, I find only sql samples in internet... > Do you know a place where I can learn more about SQL statements for Access > db in a VS2005 environment? there is a jetsql reference file, if you have Access2003 installed, do a local search for the JETSQL40.CHM file. HTH, Greetings Show quote > Thanks a lot Bart!!! > > Max. >> >>> Closing the form, it adds a search button and a FillByNameToolStrip >>> 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 >>> FillByName(dataTable As demoDataSet.myTableDataTable) As Integer" >>> >>> Here is the autogenerated vb code about the fill statement: >>> >>> Private Sub FillByNameToolStripButton_Click(ByVal sender As >>> System.Object, ByVal e As System.EventArgs) Handles >>> FillByNameToolStripButton.Click >>> Try >>> Me.MyTableAdapter.FillByName(Me.demoDataSet.MyTable, >>> NameToolStripTextBox.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. >>> >>> "RobinS" <RobinS@NoSpam.yah.none> ha scritto nel messaggio >>> news:s9udncmBQpYeAyrYnZ2dnUVZ_r-onZ2d@comcast.com... >>>> >>>> Can you post your code, or a small subset of the code >>>> showing the query stuff? >>>> >>>> Robin S. >>>> ------------------ >>>> "max" <m**@max.max> wrote in message >>>> news:ARpth.18500$bH4.6269@tornado.fastwebnet.it... >>>>> >>>>> If I do that: >>>>> SELECT * FROM table WHERE name LIKE name + '*' >>>>> >>>>> I get an error when starting compiling application: >>>>> "Too many arguments for "Public Overridable Overloads Function >>>>> FillByName(dataTable As demoDataSet.myTableDataTable) As Integer". >>>>> It reminds in a VB line: >>>>> "Me.MyTableTableAdapter.FillByName(Me.demoDataSet.myTable, >>>>> NameToolStripTextBox.Text)", >>>>> in which the error is underlined on "NameToolStripTextBox.Text". This >>>>> is the textbox where I digit the items to search for in my db. >>>>> >>>>> Help would be appreciated. >>>>> Thanks. >>>>> >>>>> >>>>> "Shkedy" <shkedy@newsgroups.nospam> ha scritto nel messaggio >>>>> news:Og9IhOoPHHA.1248@TK2MSFTNGP03.phx.gbl... >>>>>> >>>>>> The wildcard character in Jet-SQL (Access) is * and not % >>>>>> That should do it >>>>>> >>>>>> Sagi Shkedy >>>>>> http://Blog.shkedy.com >>>>>> "Max" <nobody@devnull.spamcop.net> wrote in message >>>>>> news:45b54784$0$7735$5fc30a8@news.tiscali.it... >>>>>>> Hello, >>>>>>> I just have a form in which there's a textbox for queries. I need to >>>>>>> use the SQL statements for an Access db, like this, which works fine >>>>>>> in a SQL db: >>>>>>> SELECT * FROM table WHERE name LIKE @name + '%' >>>>>>> I just need to query the db to find names that start with letters I >>>>>>> digit in the textbox. >>>>>>> This query comes from dataset designer. If I use it in my Access db >>>>>>> I get a syntax error from framework. Which is the Access equivalent? >>>>>>> Thanks. >>>>>>> Max >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> >> >> >> > > > On Mon, 29 Jan 2007 19:35:33 GMT, "Bart Mermuys" <bmermuys.nospam@hotmail.com> wrote: ¤ > Hi Robin,¤ > I have an access 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 table WHERE name LIKE name + '*' (I'm not really sure it's ¤ > the right syntax for querying an access db). ¤ ¤ Try: ¤ ¤ SELECT * FROM table WHERE [name] LIKE ? + '%' ¤ ¤ JET uses unnamed parameters (?) and % as wildcards. ¤ Looks like the third time is the charm. ;-) Paul ~~~~ Microsoft MVP (Visual Basic) On Thu, 25 Jan 2007 11:07:52 +0100, "max" <m**@max.max> wrote: ¤ ¤ Hi Robin, ¤ I have an access 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 table WHERE name LIKE name + '*' (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 FillByNameToolStrip 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 ¤ FillByName(dataTable As demoDataSet.myTableDataTable) As Integer" ¤ ¤ Here is the autogenerated vb code about the fill statement: ¤ ¤ Private Sub FillByNameToolStripButton_Click(ByVal sender As ¤ System.Object, ByVal e As System.EventArgs) Handles ¤ FillByNameToolStripButton.Click ¤ Try ¤ Me.MyTableAdapter.FillByName(Me.demoDataSet.MyTable, ¤ NameToolStripTextBox.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... One of the first problems you will encounter is a reserved word issue. The column "name" is a Jet reserved word so you will either need to rename the column or enclose it in brackets. As was mentioned in a previous post, the wild card character for ADO is a percent symbol and not an asterisk. Paul ~~~~ Microsoft MVP (Visual Basic) Name is just 'something'. In my vb code it's 'Nome'.
Show quote "Paul Clement" <UseAdddressAtEndofMess***@swspectrum.com> ha scritto nel messaggio news:itihr29mgcl70b2gapvfnhka3vos38ugv1@4ax.com... > On Thu, 25 Jan 2007 11:07:52 +0100, "max" <m**@max.max> wrote: > > ¤ > ¤ Hi Robin, > ¤ I have an access 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 table WHERE name LIKE name + '*' (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 FillByNameToolStrip > 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 > ¤ FillByName(dataTable As demoDataSet.myTableDataTable) As Integer" > ¤ > ¤ Here is the autogenerated vb code about the fill statement: > ¤ > ¤ Private Sub FillByNameToolStripButton_Click(ByVal sender As > ¤ System.Object, ByVal e As System.EventArgs) Handles > ¤ FillByNameToolStripButton.Click > ¤ Try > ¤ Me.MyTableAdapter.FillByName(Me.demoDataSet.MyTable, > ¤ NameToolStripTextBox.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... > > One of the first problems you will encounter is a reserved word issue. The > column "name" is a Jet > reserved word so you will either need to rename the column or enclose it > in brackets. As was > mentioned in a previous post, the wild card character for ADO is a percent > symbol and not an > asterisk. > > > Paul > ~~~~ > Microsoft MVP (Visual Basic) > On Thu, 25 Jan 2007 17:15:13 +0100, "max" <m**@max.max> wrote: ¤ ¤ 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) 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. Show quote "Paul Clement" <UseAdddressAtEndofMess***@swspectrum.com> ha scritto nel messaggio news:9d3sr2lh5193a3503ie1cibrsum3a56m7g@4ax.com... > On Thu, 25 Jan 2007 17:15:13 +0100, "max" <m**@max.max> wrote: > > ¤ > ¤ 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) > 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. 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). 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. Please give us more specifics. Robin S. --------------------------------------------------------------- Show quote "max" <m**@max.max> wrote in message news:12pvh.29343$bH4.16252@tornado.fastwebnet.it... > > 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" <UseAdddressAtEndofMess***@swspectrum.com> ha scritto nel > messaggio news:9d3sr2lh5193a3503ie1cibrsum3a56m7g@4ax.com... >> On Thu, 25 Jan 2007 17:15:13 +0100, "max" <m**@max.max> wrote: >> >> ¤ >> ¤ 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) >> > > > Hi Robin,
"RobinS" <RobinS@NoSpam.yah.none> ha scritto nel messaggio That's right.news:BbKdnVVw8dqLGyPYnZ2dnUVZ_qyjnZ2d@comcast.com... > > 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. > So you have a Windows Form (?) with a textbox on it where the user is Yes, it's a Windows Form, I dragged a textbox on it.> going to put in search criteria, like "bro" for "bro*" (e.g. Brown). > I'm not sure how you added the query you're talking about. This doesn't I'm working with VS2005. I had put a textbox bounded from datasource and, > 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. 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 Show quote > > Please give us more specifics. > > Robin S. > --------------------------------------------------------------- > > "max" <m**@max.max> wrote in message > news:12pvh.29343$bH4.16252@tornado.fastwebnet.it... >> >> 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" <UseAdddressAtEndofMess***@swspectrum.com> ha scritto nel >> messaggio news:9d3sr2lh5193a3503ie1cibrsum3a56m7g@4ax.com... >>> On Thu, 25 Jan 2007 17:15:13 +0100, "max" <m**@max.max> wrote: >>> >>> ¤ >>> ¤ 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) >>> >> >> >> > > > Robin,
the question has been solved. This is the right code: SELECT * FROM table WHERE [name] LIKE ? + '%' I got it from Bart Mermuys, as you can read some post below. Thanks a lot for your help. Max. Show quote "max" <m**@max.max> ha scritto nel messaggio news:q_Fvh.31080$bH4.28155@tornado.fastwebnet.it... > > > Hi Robin, > > "RobinS" <RobinS@NoSpam.yah.none> ha scritto nel messaggio > news:BbKdnVVw8dqLGyPYnZ2dnUVZ_qyjnZ2d@comcast.com... >> >> 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. >> --------------------------------------------------------------- >> >> "max" <m**@max.max> wrote in message >> news:12pvh.29343$bH4.16252@tornado.fastwebnet.it... >>> >>> 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" <UseAdddressAtEndofMess***@swspectrum.com> ha scritto nel >>> messaggio news:9d3sr2lh5193a3503ie1cibrsum3a56m7g@4ax.com... >>>> On Thu, 25 Jan 2007 17:15:13 +0100, "max" <m**@max.max> wrote: >>>> >>>> ¤ >>>> ¤ 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) >>>> >>> >>> >>> >> >> >> > > > > Brilliant! I'm so glad.
Robin S. ------------------------------ Show quote "max" <m**@max.max> wrote in message news:8AIvh.31420$bH4.28690@tornado.fastwebnet.it... > > Robin, > the question has been solved. > This is the right code: > SELECT * FROM table WHERE [name] LIKE ? + '%' > I got it from Bart Mermuys, as you can read some post below. > > Thanks a lot for your help. > Max. > > "max" <m**@max.max> ha scritto nel messaggio > news:q_Fvh.31080$bH4.28155@tornado.fastwebnet.it... >> >> >> Hi Robin, >> >> "RobinS" <RobinS@NoSpam.yah.none> ha scritto nel messaggio >> news:BbKdnVVw8dqLGyPYnZ2dnUVZ_qyjnZ2d@comcast.com... >>> >>> 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. >>> --------------------------------------------------------------- >>> >>> "max" <m**@max.max> wrote in message >>> news:12pvh.29343$bH4.16252@tornado.fastwebnet.it... >>>> >>>> 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" <UseAdddressAtEndofMess***@swspectrum.com> ha scritto >>>> nel messaggio news:9d3sr2lh5193a3503ie1cibrsum3a56m7g@4ax.com... >>>>> On Thu, 25 Jan 2007 17:15:13 +0100, "max" <m**@max.max> wrote: >>>>> >>>>> ¤ >>>>> ¤ 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) >>>>> >>>> >>>> >>>> >>> >>> >>> >> >> >> >> > > > Hello Max,
I think your problem is in the sintax: you've got a field called 'nome' and in the WHERE clause you use it again. If you want to get all names starting with 'Al', you have to state something like this: SELECT * FROM tlbPatients WHERE nome LIKE 'Al*' so if your second 'nome' is a parameter that gets its value from any other place (VS, for example) I think you should rename it to something different than the field and change your sintaxis like this: SELECT * FROM tlbPatients WHERE nome LIKE param_nome + '*' Thanks what I think without having more clues. Regards, Carlos M Perez http://www.picacodigos.com mailto:carlosm.pe***@gmail.com M> I repost this, with the actual column names: M> I have an Access2003 db; in my form I have a textbox; on it, click on M> data M> menu, M> added a new query, gave it a name and put it in query text: M> SELECT * FROM tblPatients WHERE nome LIKE nome + '*' (I'm not really M> sure M> it's the M> right syntax for querying an access db). M> Closing the form, it adds a search button and a FillByNomeToolStrip M> object. M> My target is to write a partial text in the textbox, clilck to the M> button M> just created, and get all the names that start for my partial text, M> ie: I M> type just "bro" to get all the names starting from "bro" (brown, M> browns, M> brother etc.). It sounds very simple. Using the SELECT instruction M> above, M> and start compiling app, I get this: M> "Too many arguments for "Public Overridable Overloads Function M> FillByNome(dataTable As demoDataSet.tblPatientsDataTable) As Integer" M> M> Here is the autogenerated vb code about the fill statement: M> M> Private Sub FillByNomeToolStripButton_Click(ByVal sender As M> System.Object, ByVal e As System.EventArgs) Handles M> FillByNomeToolStripButton.Click M> Try M> M> Me.tblPatientsAdapter.FillByNome(Me.demoDataSet.tblPatients, M> NomeToolStripTextBox.Text) M> Catch ex As System.Exception M> System.Windows.Forms.MessageBox.Show(ex.Message) M> End Try M> End Sub M> I just need to get the result as indicated. I welcome any other M> methos, if it exists. I'm trying to use designer for most of the job M> in vb programming. Probably it's not the best method... M> M> Thanks. |
|||||||||||||||||||||||