DataSource Controls :: Looping Through Data Locking For Each Thread?
Feb 12, 2010
I need to have maybe 5 threads running which all use the same DataSet and need to loop through all the rows retrieved but each row must be processed by one thread only (e.g. I don't want row 1 to be processed by thread 1 and thread 3).
I can also use a DataReader if that helps, but I need to dow some locking logic I would have thought.
I have a Gridview that has Paging enabled, and I need to loop through all the rows of the data. Therefore, I assume I need to loop through the datasource instead of through the Gridview.
I change the datasource of my gridview at various times when running.
How can I get a DataView of the GridView's current DataSource, so that I can loop through it?
Something like:
Dim dv as DataView = DirectCast(GridView1.DataSource, DataView)
except that this comes back as Nothing, probably because a Datasource isn't a dataview.
I am modifying a rather large ETL package using BIDS. It builds a datawarehouse, so there are many sources and a single destination. There are quite a few data flow tasks, and their connection strings are read into variables from an encrypted source. All the data flow tasks are arranged serially because of variable locking issues - occasionally two DFTs attempt to simultaneously lock the variable and it fails. I realize there are script solutions out there, but I am looking for perhaps a more elegant (easier) solution than to apply scripted solutions to tons of packages over something so trivial.
I came across the "RetainSameConnection" connection property, and I have a hunch this could be the solution. My reasoning is: If there's only one connection to a data source, there should only be one read operation from the variable. At least, it makes sense when SOURCING.As for destinations, I'm not sure if it's a good idea to have data from multiple sources flowing in through a single connection.This is my first week working in ETL so I don't know all the nuances of databases, ETLs, connections, etc.
In the development environment, in SSMSE > MyDatabase > Security > MyUser > Database role membership I have checked db_owner to allow me to build the database.
Now I am copying the database to the production environment I would like to lock the security down tightly. In the past (with classic ASP applications) I have only checked db_datawriter and db_datareader and, in Securables, checked Execute Grant on the stored procedures.
In Database > Securables I add my stored procedures and check Execute/Grant for each of them and click OK. When I return to the securables page the stored procedures are no longer listed.
I have noticed that nothing is listed in Effective Permissions and I think it should list Execute. If this is the problem, how do I add Execute to the Effective Permissions list?
How to loop through the table get only paticular records based on the particular value and store it in a datatable.
for example, i've a table with two columns, Store name and Store number. For a single store name it can have mulitple store number like [store name ] [store number] a1 10 b1 12 a1 15 a1 21 b1 11 b1 22 a1 25 etc.... How to loop through the table and get all the records/ rows of a paticular store name and store it in a datatable.
I am curious, if it's better to iterate through a set of records using cursor or using a WHILE (SELECT ..) ? I have read that cursors can be expensive, so may be WHILE (SELECT..) is a better approach.But I am not sure ?
EXAMPLE OF WHILE (SELECT..) is as below DECLARE @warehouseId INT DECLARE @warehouseIds TABLE ( WarehouseId INT )
I want to remove checked items from checklistbox (winform control) in class file method which i am calling asynchronously using deletegate. but it showing me this error message:-
Cross-thread operation not valid: Control 'checkedListBox1' accessed from a thread other than the thread it was created on.
i have tried invoke required but again got the same error. Sample code is below:
Looping Through Checkbox List and adding selected items to MS SQL DatabaseI don't want to store it using comma deliminator.I will need to do a search on analyze which users have what music in common.The image above is from a tbl_lookup_music table I created. MusicID, MusicNow how should I build the logicIF we have a user that has a tbl_profile table. And listens to many different types of music. How should We store the data.------------------------------------------------------------------------------------------CREATE TABLE [dbo].[tbl_lookup_music]( [MusicID] [int] IDENTITY(1,1) NOT NULL, [Music] [nvarchar](64) NOT NULL, ---- Type of music. CONSTRAINT [PK_tbl_lookup_music] PRIMARY KEY CLUSTERED ( [MusicID] ASC )WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY----------------------------------------------------------------------------------------------CREATE TABLE [dbo].[tbl_Profile_Music]( [ProfileMusicID] [int] IDENTITY(1,1) NOT NULL, [ProfileID] [int] NOT NULL, [MusicID] [int] NOT NULL,PRIMARY KEY CLUSTERED ( [ProfileMusicID] ASC)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GOHow should I setup this table.
This table receives data from my web application via a stored procedure, snippet pasted below:
[Code]....
In my quote.aspx page, I have a wizard control that collects numerous data points. In one of the wizard steps, I have 20 textbox controls for PartNumbers and 20 textbox controls for respective Quantity.
Question:How do I write a for..each loop that checks for values in my Part Number and Quantity fields and inserts them via my SQLDataSource?
In a multiuser asp.net web application that performs CRUD functions, how is a record in a listview control "greyed" out while someone else is making changes or would you consider I need a custom asp.net control,
I have a nested gridview on my page, I have to apply sorting on that grid and wants the header to be locked. Means when I scroll the grid the header should be visible all the time.I have mousehover and onclick event applied on this grid. Whenevr I try to apply some code to fix the header, it results in detaching of header and moves up the screen on every scroll.
I have a ListView which has Product Code,Desc, ColorCode, Size and Quantity as the columns as well as a checkbox
The listbox sits within a panel.
The user enters the quantity and checks the item(s) they wish to purchase. They accept their selection by clicking a button the sit within the ItemView
Once they have made their order and clicked the button I want to make the panel disappear and display the items on the page.
how to iterate through the Listview and how to grab the items and close the panel
I am trying to looping thru a data table and update a column on each row. However after updating I am getting both before and after update records in the data table. Assuming there is only one column called "Qty" withing the data table and I want to double the value in the column. I use the following to perform updating but not getting my expected result.
I am trying to add the checked rows into the database by looping through but im getting this error:
Object reference not set to an instance of an object.
Description:
An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
I have two gridview. The first gridview with checkbox and if i check the checkbox in first grid that particular row will be binded to second grid. In second grid i have a textbox and dropdown. Have enabled pagination in both grids. When i check the checkbox in first grid i loop through all records in second grid to bind the previous values. Problem is since i have enabled pagination gridview row count only retuns current page row count. How to loop through all rows?.
I know that the datagrid control loops through a database table from the first row to the last, but I want it to loop from the last row to the first. How can I do that? Also I wanted to know how could I drop some rows according to my needs while looping from end to start, so that the datagrid only displays those rows that I need to display?
I have a gridview that serves as a confirmation for user input in a previous form from a previous page. The grid is databound to a temporary table where I store the user's initial selections. The user can confirm what they had submitted, (which may be more than one row of information, up to three classes) or go back and change. When they hit the confirm button, I loop through the gridview and enter a row in a permanent database for each row in the gridview. This works great.
However, I don't want the gridview to display all of the columns that are actually in the temp database, because I'm carrying over 'usersubmitted, datesubmitted', etc, from the previous page for each class selected and this is redundant. (I do need to use all of the columns when they submit, however, to make a new row with complete information for each selected class in the permanent database) So, when I set the usersubmitted column visible false, for example, in the gridview, the dataset table adapter insert function fails with a data type mismatch error. I'm assuming becuase the column has to be visible, becuase when I make it visible again it works.
Can you loop through a gridview and call on cells in columns that are not visible?
The first page is like this:
the user fills out his info once in text boxes
name ____
address____
then selects up to three classes in dropdowns:
class one dropdown ...
class two dropdown....
for each dropdown, I insert name, address, class selected into a temp db Second page.
Gridview should display only classes selected, one row for each, and not
I'm new to threading and have used it successfully, but limited. I can spawn a thread and have the main thread reference variables in the spawned thread, but I don't know how to allow the spawned thread to reference (and update) variables in the main thread.
Any example threading code I've seen on the web appears to be WAY more complicated than what I do, so I am unable to understand or integrate into my code.