473,811 Members | 2,971 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 cboContactPosit ion_SelectedInd exChanged _
(ByVal sender As System.Object, _
ByVal e As System.EventArg s) _
Handles cboContactPosit ion.SelectedInd exChanged

' Define and build the SQL statement for the data grid . . .
..
..
..
daXtreme.Select Command.Command Text = strSql.ToString

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

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

End Sub

Oct 18 '05 #1
3 4098
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***@discussi ons.microsoft.c om> wrote in message
news:00******** *************** ***********@mic rosoft.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 cboContactPosit ion_SelectedInd exChanged _
(ByVal sender As System.Object, _
ByVal e As System.EventArg s) _
Handles cboContactPosit ion.SelectedInd exChanged

' Define and build the SQL statement for the data grid . . .
.
.
.
daXtreme.Select Command.Command Text = strSql.ToString

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

Me.daXtreme.Fil l(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***@discussi ons.microsoft.c om> wrote in message
news:00******** *************** ***********@mic rosoft.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 cboContactPosit ion_SelectedInd exChanged _
(ByVal sender As System.Object, _
ByVal e As System.EventArg s) _
Handles cboContactPosit ion.SelectedInd exChanged

' Define and build the SQL statement for the data grid . . .
.
.
.
daXtreme.Select Command.Command Text = strSql.ToString

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

Me.daXtreme.Fil l(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.publi c.dotnet.langua ges.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
4325
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 be better to promote better programming than rely on PHP to compensate for lazy programming?
4
6431
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 well as some color coding, etc. Having trouble finding the same in an editor that'll run on OS X. -- Floydian Slip(tm) - "Broadcasting from the dark side of the moon"
11
4016
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
18545
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 blocks until something.exe terminates. Just what I /don't/ want. (Wouldn't an & be nice here! Sigh) I need something.exe to disconnect and run in the background while I
1
3706
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 sockets??
10
4229
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
3662
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 say that i like it to see mysql replaced by a real database (stored procedures etc.)
1
3642
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 NOT IN ( SELECT manufacturers_id FROM products )
2
106621
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 cyclery? Look no further! </P> <FORM NAME='frmJobApp' METHOD=post ACTION="jobapp_action.php"> Please enter your name:
1
3831
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 fazer?
0
9730
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10392
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5555
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4341
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.