|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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.
|
|
#3
|
|||
|
|||
|
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? |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
|||
|
|||
|
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 |
|
#6
|
|||
|
|||
|
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! |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > help to close this recordset! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|