Using Con,open And Close When We Use A Dataset Is A Bad Coding Practise?
Mar 15, 2011
below i am using dataset and con.oen and close. but i read that dataset doesnt require con.open/close since it does that autoatically.now my project is complete and implemented with opens and closes for datasets.here is code for all datasets are liek this:-
[Code]....
1)so is what i have done a bad coding practise?2)will it make the application pool to hang?3)should i remove all open/close from the files?
Dim ds As DataSet = New DataSet
con.Open()
Dim dad As SqlDataAdapter = New SqlDataAdapter(cmd)
When should i open and close the database connection.and which are best data classes (for e.g dataset, datatable etc) should i use when connection is open or close.
Is this necessary to open and close connection when i am using SqlDataAdapter and DataSet to get data from from table from databse in sql server? Which one will be better to use in the following code. Code1 or Code2.
Code: 1 With open and colse connection
public DataSet GetFAcadSlidingImage() { SqlConnection con = GetConnection(); cmd = new SqlCommand("Pro_GetFAcadSlidingImage", con); cmd.CommandType = CommandType.StoredProcedure;
[Code].....
Code:2 Without open and colse connection
public DataSet GetFAcadSlidingImage() { SqlConnection con = GetConnection(); cmd = new SqlCommand("Pro_GetFAcadSlidingImage", con); cmd.CommandType = CommandType.StoredProcedure;
does anyone have any working code that uses javascript to open and close a cpe when the CPE is in a masterpage? It seems like the javascript never is able to find the CPE when it is on a master page. I have an DropDownList on the page and when certain items are selected, i want to collapse or expand when others are selected. It seems to work fine on a regular page, but not when it is a page nested in a master page. It is adding a suffix to the CPE and javascript is unable to find it.
In PageA, there is a button to open a crystal report. I want to add a HTML button into crystal report to close report(browser) and back to PageA. How to use javascript to do this job?
I am tring to open the panel with clicking linkbutton and to close the same panel using that link button .How can i write close and open in one event .
I've created a blog for my first asp.net website. Ive got a blog class as my object. Ive created a number of methods to access my blog articles using LINQ to SQL.
Each method returns a list of objects ready to be used in the appropriate web user control.
In my head i need to cache these lists of objects that are returned, but need to know the best way of approaching this. So i have come up with two possible options
1: Make one method to retrieve all blogs in a list<Blog> and cache this list to be used for all other methods or
2: Cache only the required methods that really need it.
In PageA, there is a button to open a crystal report. I want to add a HTML button into crystal report to close report(browser) and back to PageA. How to use javascript to do this job?
In Visual Studio Team Edition there is a load test tool where you can select unit tests, integration tests etc... to form scenarios which are then used in a load test session with different configurations for example varying usage levels.
Looking at for example the NUnit framework, it would be possible to develop a form of such a tool, along with a base load testing code base, but I was interested if anyone knows of any open source project which has has already done a similar thing which could then be of use for this situation and possibly extended?
I have a login page that is loaded in popup window (colorbox) and after user logs in it should be closed and parent window should be loaded with new page.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Do While reader.Read() If Trim(reader("ZAP").ToString()) = Trim(textBoxZap.Text) Then Session("A") = "1" Response.Redirect("~/default.aspx") Else lblErr.Text = "incorect" End If Loop
So once the buton is clicked and user name and password is corect popup window should be closed and user redirected to default aspx.
I have a series of collapsible panel extenders on my page and each time the page opens or postsback the panels open for a time and then close. Is there a way to prevent this?
I have website which runs multiple threads. When user close the browser but threads are still running. How to kill/stop all thread in asp.net on browser close.
I have a web page with paypal. In the page user add items to list then buy it. when user add item to list i block that item in stock until user buy or delete that item.Now my problem is when user add item in the list and then close the broswer from IE close button , the item get blocked. I want to rollback the added items when user close the browser from IE button.
In my project I work with Entity Framework (LINQ to ENTITY). I only have ADO.NET Entity Data Model and a DAL (Data Access Layer). I also get the data due a WCFClientService. I have a gridview that needed to be exported in Excel.
FlexCel is a tool for generating Excel files based on a template. The only thing I see in demo's is that they work with DataSets.
Is there a way to convert the data in my gridview to a virtual DataSet?
I've written the following method to get the data:
Till now I used to design RDLC file before and assigned typed dataset table columns.Report processing mode is local. But now my stored procedure returns different columns based on condition i.e columns are not fixed every time. Now I need to add that columns to typed dataset and dataset is assigned to RDLC file. So dataset and RDLC files are create dynamically based on stored procedure result set columns.
What I am thinking is this? Is it possible for me to upload the data from an excel file to dataset of my application first, so that the user can view the data in a gridview to review it first, before the user strike the save button, to save it in the database. So, that in case there is a problem, the gridview will high light all the data with an error. So the user can easily pull out the excel and correct the data before saving it in the database.
how do i copy required row in dataset to a new dataset. i have bind a xml into a dataset and i need to display say row 3 to 5 only so i do a for loop but i have encounter problem when trying to copy the rows to a new dataset.
do i have to write the xml to datatable and bind it to dataset and from there copy over ?
I Developing a erp project in that there are more than 100 screens i should provide a one button or any other option if users click that button it show all screens so far you have used for eg:alt+tab event if we press it comes so far used same functionality should be overcome in my project how to achieve this.