SunQuest
 
           Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old July 13th, 2004, 10:05 AM
Kristin Kristin is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 56 Kristin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Unhappy help to close this recordset!

Anybody out there have any easy code to close a recordset? I can't get this to work! My object is a datagrid produced by an SQL query called as a command in my DataEnvironment...


here it is, but how do I close it without exiting the application?

Private Sub cmdFilter_Click()
' run the query, passing the expected parameters.
DataEnvironment1.SearchCompany txtCompany & "%", txtState, txtConfname1, txtLocation
' Ensure the grid is bound to the DataEnvironment
Set DataGrid1.DataSource = DataEnvironment1
DataGrid1.DataMember = "SearchCompany"
End Sub

any ideas for me?
kristin

Reply With Quote
  #2  
Old July 13th, 2004, 10:28 AM
spak111 spak111 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 349 spak111 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 25 sec
Reputation Power: 5
Send a message via AIM to spak111
Currently, you have no recordset delcared. Please clarify exactly what you are doing and what you mean by recordset so that we may better help you with your question.

Reply With Quote
  #3  
Old July 13th, 2004, 02:39 PM
Kristin Kristin is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 56 Kristin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
sorry I'm new. Actually, I just need to clear the results (recordset???) in my datagrid. I query the database, say searching for companies.....it returns a list of all my companies. Now I need to clear it, from my current active form and requery. that make any sense?

Reply With Quote
  #4  
Old July 13th, 2004, 03:39 PM
spak111 spak111 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 349 spak111 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 25 sec
Reputation Power: 5
Send a message via AIM to spak111
Okay, what you want to do is to clear the datagrid. To do that you will need to make the DataEnvironment return no records. You can do that in a number of ways, such as using a parameter value that you know isn't in the table of values.

But if you just want to requery it, you don't have to clear the datagrid out first. Change the DataEnvironment accordingly and then reattach the Datagrid to the Environment and the new values should populate. I hope this helps.

Reply With Quote
  #5  
Old July 13th, 2004, 06:05 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 19 h 13 m
Reputation Power: 180
Can't you just

set datagrid1.datasource = nothing?
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #6  
Old July 14th, 2004, 10:44 AM
Kristin Kristin is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 56 Kristin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
right! that is exactly it, however, in order for my requery to work, I had to close the connection. Setting the datasource = nothing was only the first part, because it still thought the connection was open. Anyway, here is what ended up working for me:


Private Sub cmdClearForm_Click()
Dim ctlClear As Control
For Each ctlClear In Controls
If TypeOf ctlClear Is TextBox Then
ctlClear.Text = ""
End If
Next
Set DataGrid1.DataSource = Nothing
Set DataEnvironment1 = Nothing
End Sub

Thanks for all the help and input!

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > help to close this recordset!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway