displaying data in datagrid

srivalli

Well-known member
Joined
May 4, 2005
Messages
189
Programming Experience
Beginner
in my table
i have many banks
say in each bank there are 10 transactions i mean say 10 customers

so my query is

when i select a particular bank from combobox or a dropdown list
i want to display that particular bank details in a datagrid

and when i display next bank ,i want to display only that particular bank details in a data grid
its veryyyyyyyyyyyy urgent
thks
 
It seems that every question you post is veryyyyyyyyyyy urgent. Everyone has a life and we will get to your question if and when we can.

If you have bound your DataGrid to a DataTable, you can set the RowFilter property of the associated DataView, which is accessed via the DefaultView property of the DataTable. The RowFilter property accepts a String that contains a valid SQL "where" clause for that table. As an example, the following code will display only the rows with an ID value greater than 100 in the DataGrid:
VB.NET:
myGrid.DataSource = myTable

myTable.DefaultView.RowFilter = "ID > 100"
You can then change the RowFilter property at any time to change which rows are displayed. The DataView class also has Sort and RowStateFilter properties that may come in handy.
 
the thing is i ll break my head into as much peices as i can

ultimately if i dont get it and there is no time then i ll post it as veryyy urgent
that all
from next time i ll try to avoid that word
any way thank u for ur response
i ll try this one

jmcilhinney said:
It seems that every question you post is veryyyyyyyyyyy urgent. Everyone has a life and we will get to your question if and when we can.

If you have bound your DataGrid to a DataTable, you can set the RowFilter property of the associated DataView, which is accessed via the DefaultView property of the DataTable. The RowFilter property accepts a String that contains a valid SQL "where" clause for that table. As an example, the following code will display only the rows with an ID value greater than 100 in the DataGrid:
VB.NET:
myGrid.DataSource = myTable
 
myTable.DefaultView.RowFilter = "ID > 100"
You can then change the RowFilter property at any time to change which rows are displayed. The DataView class also has Sort and RowStateFilter properties that may come in handy.
 
giving name as input not the number

ur code is working fine,if i am using any number column as input

ie in dataadapter if i give
'select * from table1 where id>100",cn

then it is working fine.
but i want to display the columns by giving bankname as input then how to mention the query
i want to select the bank at run time.

srivalli said:
the thing is i ll break my head into as much peices as i can

ultimately if i dont get it and there is no time then i ll post it as veryyy urgent
that all
from next time i ll try to avoid that word
any way thank u for ur response
i ll try this one
 
I've added srivalli's most often used words like urgent, bankname, veryyyyyyyyyyy and couple yet to the search engine and i couldn't beleive ... wow man that's unbelievable.

i.e. this is what searsh engine returned for key word bankname http://www.vbdotnetforums.com/search.php?searchid=84107

it seems like he has been engaged by come banks :D


Cheers ;)
 
srivalli said:
ur code is working fine,if i am using any number column as input

ie in dataadapter if i give
'select * from table1 where id>100",cn

then it is working fine.
but i want to display the columns by giving bankname as input then how to mention the query
i want to select the bank at run time.
I'm not sure I know what you mean. The RowFilter property can be set to ANY valid "where" clause, e.g.
VB.NET:
myTable.DefaultView.RowFilter = "bankname = 'bank1'"
If this is not the information you're after then you'll have to rephrase the question.
 
got the solution

thank u for ur searching

atlast i got the solution
just in the string give

ss="select * from tab where bankname=' " & combobox1.text &" '

the mistake i did is i weas trying using combobox1.selecteditem and combobox1.selectedvalue
so it was not coming

atlast i got it
thanks
kulrom said:
I've added srivalli's most often used words like urgent, bankname, veryyyyyyyyyyy and couple yet to the search engine and i couldn't beleive ... wow man that's unbelievable.

i.e. this is what searsh engine returned for key word bankname http://www.vbdotnetforums.com/search.php?searchid=84107

it seems like he has been engaged by come banks :D


Cheers ;)
 
i got one doubt recently which is not at all urgent nor it includes the word "BANK"

just joking
ok
my query is

after searching for a particular word in record or say table if we want to display the no. of times it occured then what to do


kulrom said:
You are amazing :)
 
To get the number of rows that contain a particular word in a particular field, you would use something like the following:
VB.NET:
SELECT COUNT(*) FROM Table1 WHERE field1 LIKE '%word%'
If you want to know how many times the word occurs in total, including multiple times in the one record, I think you would have to just get all the rows and then count the number of occurrences yourself.
 
Back
Top