|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to check datatable.selectHow do I check datatable.select(filter) in the following: for each dtrow in datatable.select(filter) .... next I've also tried: if not (datatable.select(filter) is nothing) then for each dtrow in datable.select(filter) ..... next end if but it gets an exception in my catch. I get an error when the select doesnt find any rows to return. How can I chech for this or is there a property to use? Basically, if the select doesnt find any rows, then I want to do something else. thanks, Will
Show quote
Hide quote
"wk6pack" <wk***@sd61.bc.ca> schrieb Check the length property of the array returned. If it's 0, no rows have > Hi, > > How do I check datatable.select(filter) in the following: > > for each dtrow in datatable.select(filter) > ... > next > > I've also tried: > > if not (datatable.select(filter) is nothing) then > for each dtrow in datable.select(filter) > ..... > next > end if > but it gets an exception in my catch. > > I get an error when the select doesnt find any rows to return. How > can I chech for this or is there a property to use? > Basically, if the select doesnt find any rows, then I want to do > something else. been returned. Armin Hi,
There are records in the datatable but not on the filter. Datatable.rows. ie. datatable has records a1, a2 but I want to see if a3 is in there. datatable.select("col1='ad3') will error out with Error: can't find column [a3]. I want to prevent this. I'm not sure what you mean check the array length? I dont see that method on the datatable. thanks, Will Show quoteHide quote "Armin Zingler" <az.nospam@freenet.de> wrote in message news:OWWqJt8GGHA.1396@TK2MSFTNGP11.phx.gbl... > "wk6pack" <wk***@sd61.bc.ca> schrieb > > Hi, > > > > How do I check datatable.select(filter) in the following: > > > > for each dtrow in datatable.select(filter) > > ... > > next > > > > I've also tried: > > > > if not (datatable.select(filter) is nothing) then > > for each dtrow in datable.select(filter) > > ..... > > next > > end if > > but it gets an exception in my catch. > > > > I get an error when the select doesnt find any rows to return. How > > can I chech for this or is there a property to use? > > Basically, if the select doesnt find any rows, then I want to do > > something else. > > > Check the length property of the array returned. If it's 0, no rows have > been returned. > > > Armin > "wk6pack" <wk***@sd61.bc.ca> schrieb In this example, you use the column name "Col1", thus I don't understand how > Hi, > > There are records in the datatable but not on the filter. > Datatable.rows. ie. datatable has records a1, a2 but I want to see > if a3 is in there. > > datatable.select("col1='ad3') will error out with Error: can't find > column [a3]. I want to prevent this. it can not find column "a3". What are the available column names, what are the values in these columns and what is the value you are searching for? > I'm not sure what you mean check the array length? I dont see that I wrote, "of the array returned". I meant the array that is returned from > method on the datatable. the Select method. Armin Hi Armin,
The column, col1 exists but the value in col1 is not found. so it returns the error. Will Show quoteHide quote "Armin Zingler" <az.nospam@freenet.de> wrote in message news:etg4vpFHGHA.1288@TK2MSFTNGP09.phx.gbl... > "wk6pack" <wk***@sd61.bc.ca> schrieb > > Hi, > > > > There are records in the datatable but not on the filter. > > Datatable.rows. ie. datatable has records a1, a2 but I want to see > > if a3 is in there. > > > > datatable.select("col1='ad3') will error out with Error: can't find > > column [a3]. I want to prevent this. > > In this example, you use the column name "Col1", thus I don't understand how > it can not find column "a3". What are the available column names, what are > the values in these columns and what is the value you are searching for? > > > I'm not sure what you mean check the array length? I dont see that > > method on the datatable. > > I wrote, "of the array returned". I meant the array that is returned from > the Select method. > > > Armin > "wk6pack" <wk***@sd61.bc.ca> schrieb If it doesn't find a row, it does not return this error. If it does, there > Hi Armin, > > The column, col1 exists but the value in col1 is not found. so it > returns the error. must be something wrong elsewhere to which I don't have insight. Can you reproduce the problem in a new project? If you can, you can send it to me (zipped please; insert an underscore between "no" and "spam" in my email address) Armin WK6Pack,
Are you sure that your table exist? \\\ Dim dt As DataTable If Not dt Is Nothing Then If Not dt.Select() Is Nothing Then For Each dr As DataRow In dt.Select() Next End If End If /// This runs for me although that it does nothing of course. I hope this helps, Cor Hi,
The table exists with records there. If you select on the filter without finding a record in the datatable, it will error out. thanks, Will Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:OFoKtIBHGHA.2440@TK2MSFTNGP14.phx.gbl... > WK6Pack, > > Are you sure that your table exist? > \\\ > Dim dt As DataTable > If Not dt Is Nothing Then > If Not dt.Select() Is Nothing Then > For Each dr As DataRow In dt.Select() > Next > End If > End If > /// > This runs for me although that it does nothing of course. > > I hope this helps, > > Cor > >
How do menu list with one check
looping through datareader ShellExecute in VB2005 How to minimize to system tray ? VS 2003 Keep software running Working with structures and the New keyword Custom Property array of interface? Using SP_Password with VB.NET but keep getting "old (current) password incorrect for user" LIKE operator question |
|||||||||||||||||||||||