473,241 Members | 1,626 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,241 software developers and data experts.

How to re-populate a Data Grid?

I have a vb .net program which fills a data grid upon form load from an
acccess database. This works great. Now, I have to add a combo box and use
it to alter the underlying sql statement and re-fill the data grid. I have
never done this before, but I created a new sql statement in strSql from the
combobox, update the data adapter, and try to fill the data grid. The
program halts on the Fill with no particular explanation or complaint that I
can determine. Something tells me that I have to do something else before
the Fill from the dataset. Any suggestions?

Thanks,

Michael
Private Sub cboContactPosition_SelectedIndexChanged _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles cboContactPosition.SelectedIndexChanged

' Define and build the SQL statement for the data grid . . .
..
..
..
daXtreme.SelectCommand.CommandText = strSql.ToString

' Fill the data grid using the new Sql command. . .

Me.daXtreme.Fill(dsXtreme) ' Debug hangs here for some
reason.

End Sub

Oct 18 '05 #1
3 4046
Michael - if you aren't getting new rows from the database, you may want to
just use one of the datatable/dataview methods to filter your data. However
if you're freezing, then you need to look at what's happening there. First
check your sql command and make sure it's valid. Next make sure it's
returning and filling the datatable properly (make sure you don't have any
try/catch blocks that just eat the exception). Check the table to make sure
that you aren't filling on top of existing values (if you refilled a table
with no primary key or constraints, then the values woudl be appended at the
end and it would appear to not have changed, b/c the rows are down at the
bottom - even though the datatable has been refilled. If none of those are
it, let me know and we'll take it from there.

Cheers,

Bill
"Snake" <Sn***@discussions.microsoft.com> wrote in message
news:00**********************************@microsof t.com...
I have a vb .net program which fills a data grid upon form load from an
acccess database. This works great. Now, I have to add a combo box and
use
it to alter the underlying sql statement and re-fill the data grid. I
have
never done this before, but I created a new sql statement in strSql from
the
combobox, update the data adapter, and try to fill the data grid. The
program halts on the Fill with no particular explanation or complaint that
I
can determine. Something tells me that I have to do something else before
the Fill from the dataset. Any suggestions?

Thanks,

Michael
Private Sub cboContactPosition_SelectedIndexChanged _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles cboContactPosition.SelectedIndexChanged

' Define and build the SQL statement for the data grid . . .
.
.
.
daXtreme.SelectCommand.CommandText = strSql.ToString

' Fill the data grid using the new Sql command. . .

Me.daXtreme.Fill(dsXtreme) ' Debug hangs here for
some
reason.

End Sub

Oct 18 '05 #2
I added a try/Catch. I get "No value given for one or more required
parameters" from the Fill. I searched MSDN but to no avail yet. I can not
tell if the complaint is about the actual SQL code which looks fine and has
no parameters or something else. I keep thinking that some additional method
has to be executed prior to executing the second Fill. I will keep digging
.. . .

Michael
"W.G. Ryan - MVP" wrote:
Michael - if you aren't getting new rows from the database, you may want to
just use one of the datatable/dataview methods to filter your data. However
if you're freezing, then you need to look at what's happening there. First
check your sql command and make sure it's valid. Next make sure it's
returning and filling the datatable properly (make sure you don't have any
try/catch blocks that just eat the exception). Check the table to make sure
that you aren't filling on top of existing values (if you refilled a table
with no primary key or constraints, then the values woudl be appended at the
end and it would appear to not have changed, b/c the rows are down at the
bottom - even though the datatable has been refilled. If none of those are
it, let me know and we'll take it from there.

Cheers,

Bill
"Snake" <Sn***@discussions.microsoft.com> wrote in message
news:00**********************************@microsof t.com...
I have a vb .net program which fills a data grid upon form load from an
acccess database. This works great. Now, I have to add a combo box and
use
it to alter the underlying sql statement and re-fill the data grid. I
have
never done this before, but I created a new sql statement in strSql from
the
combobox, update the data adapter, and try to fill the data grid. The
program halts on the Fill with no particular explanation or complaint that
I
can determine. Something tells me that I have to do something else before
the Fill from the dataset. Any suggestions?

Thanks,

Michael
Private Sub cboContactPosition_SelectedIndexChanged _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles cboContactPosition.SelectedIndexChanged

' Define and build the SQL statement for the data grid . . .
.
.
.
daXtreme.SelectCommand.CommandText = strSql.ToString

' Fill the data grid using the new Sql command. . .

Me.daXtreme.Fill(dsXtreme) ' Debug hangs here for
some
reason.

End Sub


Oct 18 '05 #3
Michael,

I am not sure of your combobox is inside or outside the datagrid.

Have a look at our website there is a lot about the datagrid.

http://www.vb-tips.com/default.aspx

I have a sample with a combobox outside the datagrid, however never placed
it because that it can be confusing.

If that is were you looking for than reply *here*

By the way, this questions are often done in the newsgroup
microsoft.public.dotnet.languages.vb

There is as well my fellow Ken active while he is that not here.
Probably have you more change on answers when using the VB.Net than here.

I hope this helps so far.

Cor


Oct 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Nel | last post by:
I have a question related to the "security" issues posed by Globals ON. It is good programming technique IMO to initialise variables, even if it's just $foo = 0; $bar = ""; Surely it would...
4
by: Craig Bailey | last post by:
Anyone recommend a good script editor for Mac OS X? Just finished a 4-day PHP class in front of a Windows machine, and liked the editor we used. Don't recall the name, but it gave line numbers as...
11
by: James | last post by:
My form and results are on one page. If I use : if ($Company) { $query = "Select Company, Contact From tblworking Where ID = $Company Order By Company ASC"; }
4
by: Alan Walkington | last post by:
Folks: How can I get an /exec'ed/ process to run in the background on an XP box? I have a monitor-like process which I am starting as 'exec("something.exe");' and, of course the exec function...
1
by: John Ryan | last post by:
What PHP code would I use to check if submitted sites to my directory actually exist?? I want to use something that can return the server code to me, ie HTTP 300 OK, or whatever. Can I do this with...
10
by: James | last post by:
What is the best method for creating a Web Page that uses both PHP and HTML ? <HTML> BLA BLA BLA BLA BLA
8
by: Lothar Scholz | last post by:
Because PHP5 does not include the mysql extension any more is there a chance that we will see more Providers offering webspace with Firebird or Postgres Databases ? What is your opinion ? I must...
1
by: joost | last post by:
Hello, I'm kind of new to mySQL but more used to Sybase/PHP What is illegal about this query or can i not use combined query's in mySQL? DELETE FROM manufacturers WHERE manufacturers_id ...
2
by: sky2070 | last post by:
i have two file with jobapp.html calling jobapp_action.php <HTML> <!-- jobapp.html --> <BODY> <H1>Phop's Bicycles Job Application</H1> <P>Are you looking for an exciting career in the world of...
1
by: Clarice Almeida Hughes | last post by:
tenho um index onde tenho o link pro arq css, como sao visualizados pelo include todas as paginas aderem ao css linkado no index. so q eu preciso de alguns links com outras cores no css, o q devo...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.