For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
First a quick description of the problem. A piece of software written in VB handles a lot of stuff. 6-8 active users at a time. One module deals with planning and got 2-3 users which use this.
Up until recently only one user was actively using this module but structural changes within the workforce has changed this.
This has brought on a problem where changes to the planning seems to disappear for those that plan. My problem when fixing this is that I'm not 100% exactly what does what so I want to create a solution that is as small and clean as possible to fix the issues as we are moving to another system sometime within the next 4month-2years.
The module queries an SQLDatabase and then renders the used table using some fancy VB6 graphics. Changes are made and then saved.
When a save is made a lot of rows are deleted and then remade with the new data. I think the problem might be that what is deleted isn't just those entries that are changed but a large chunks of rows fit inside the selection criteria. This means that if 50 rows are selected and 5 changed by user A which saves if user A got the data before user B made it's changes user B's changes are overwritten if their are included inside the selection criteria.
Those who use this module swear that they use the reload function correctly to make sure they got the latest data and then swiftly make their changes and saves and that in order to avoid the problem they make sure only one is editing at the time but you know... ...users.
One of the things I'm working on adding is a check where I look if someone else has changed the data before saving and compare. If user A's and user B's changes doesn't overlap I will merge these instead of overwriting everything and if there are conflicts I will promt the user as to which change they want to use.
This should fix it because even if the query selection returns the same set of data in a majority of cases they are working on different parts of this set.
That's what I've been doing so far and will implement. Even if it doesn't fit 100% what they want this will be what they get.
That should hopefully describe the current situation. Since they actually try to avoid working at the same time my boss also suggested to add a lock/semaphore to enforce the idea that only one user can edit the data. And I just wanted to get some input on a quick way of doing it.
I was thinking of adding three controls/buttons and a status window. Status window will show if and who is currently editing if its locked or if its free to take the position as editor.
Lock and unlock button as well as force unlock.
Super easy to add this as well as the logic behind this that I figured.
I'll add a table which I plan to use as my lock. This will contain one entry which says if the table should be locked. If so, who is currently owning the lock and time of locking.
Add some queries to the buttons and a few other places in the code and bam, only one user can edit.
I'm interesting in viewpoints on my solution as well as other ways to do it. What I like with this is the simplicity to implement for me and simple way of making sure that the users always can force an unlock if something should happen.
Hi, I am using Vb.net 2010. I have 2 data tables, which have different set of columns. I would like to copy the rows from one data table to another . How to loop through each of the rows in the first data table and set the values in the second data table. Thanks
One possibility is that you create a LINQ query that queries the source datatable and fetches the columns that match in the target datatable. When looping through the results, add a new row as an object array into the target table or create a new table and use that.
I'm using the example provided earlier in a previous post of mine.
I want to convert this sql linq statement into a queryable, so I can adjust the take and skip,
But I can't figure out how to Join and do Multiple contains using IQueryable.
So I wrote this which works, but now I only want to take the data I need, and not the whole table that matches. I thought I needed to go IQueryable for the Take and Skip, not being to add that to the code below. If I'm wrong, please let me know.
Dim p_pageIndex asinteger = 1Dim p_pageOffset asinteger = 10Dim p_SearchQuery asString = "Kneepads"Using context AsNew DBContext()
Dim pResults = _
From pi In context.ProductInfo
Join pik In context.ProductInfo_Keywords On pik.ProductID Equals pi.ProductID
Where pik.Keywords.Contains(p_SearchQuery.Trim) _
Or pik.Stream.Contains(p_SearchQuery.Trim) _
Order By pi.PartNumber, pi.SDescription, pi.Description Descending
In the example above, I have multiple contains from 2 tables that are Joined, I can't figure out the wording for the Join or multiple contains. the multiple OrderBy's was from a previous version in TSQL where I used ORDER By RANK
Dim context AsNew DBContext()
Dim items As IQueryable(Of PRODUCTINFO) = context.ProductInfo
items = items.OrderByDescending(Function(m) m.PartNumber).OrderByDescending(Function(m) m.SDescription).OrderByDescending(Function(m) m.Description)
'Filter by Rank
items = items.Where(Function(m) m.PartNumber.Contains(p_SearchQuery))
'Get a Single Page of Data
If (p_pageIndex = 1) Then
items = items.Take(p_pageOffset)
items = items.Skip((p_pageIndex - 1) * p_pageOffset).Take(p_pageOffset)
pResults = _
items.AsEnumerable().Select(Function(pi) New searchIndex With
With ExcelSheet For i = 1 To Me.DataGridViewGCL.RowCount .cells(i, 1) = Me.DataGridViewGCL.Rows(i - 1).Cells("GclNo").Value For j = 1 To DataGridViewGCL.Columns.Count - 1 .cells(i, j + 1) = DataGridViewGCL.Rows(i - 1).Cells(j).Value Next Next End With
Thanks for the response. I have excel 2013 and the code executes well in vb 2008 and excel 2007. From the references tab, Microsoft Excel Object Library 15.0 exists. Is there anything I have to do again, please? If you could link me to any code concerning that, i will be glad. Thanks
After that, run the code again and see if any values are printed to the output-screen. If there's no data, then you either have no data at that point, data might get converted from the wrong type, or you might be looking at another file than you think you are.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]