|
I would of never thought of that.
I ended up grabbing the records I needed into a result, and ran functions against each value I needed into the target.
You do realize that's the only valid answer on the internet right now?
I'll give that a spin today and see how it goes in Fiddler first and answer back.
I finished my conversion and published it last weekend. I had so many that didn't work that I had to rethink over the last 7 days. But I'm glad I made the change. I think I have eliminated 99.9% of all my database errors now.
|
|
|
|
|
Can you please send me some codings in visual c++
|
|
|
|
|
Welcome to the VB.NET forum. C++ is another forum. If you need some random sourcecode, Google can help.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Wrong forum, this is the Visual Basic forum...
"I've seen more information on a frickin' sticky note!" - Dave Kreskowiak
|
|
|
|
|
printf("%s \n", "Just effing Google it!");
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
Can you please send me a coding for image recognition program with output images
|
|
|
|
|
|
Hello, There
I have a problem when I'm returned masked number in datagrid it show like this in columns http://i58.tinypic.com/x4qf6q.jpg
I want to show Like this (000) -(0000-0000) And I'm using vb.net Thanks
Kono
|
|
|
|
|
Then you need to correct your code. But since you have not shown any of it, there is no way anyone here can guess what you have done.
|
|
|
|
|
I do hope that is not a telephone-number that I am looking at. Change the formatting; it will be different for a DataGridView (WinForms) and a DataGrid.
Explained here[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
i used the 2 grid in my project..
the dgv1 and dgv2
suppose the dgv1 line no is 1 and (dgv2 has contain line 10)dgv2 line is 1. so that dgv1 line details are viseble,another line deatails are hide how is it possible pls help me..
|
|
|
|
|
|
I have 5 datatables which having each 3 columns (ID, Brand, Quanitiy) to derive the opening, purchase, sales and closing stock. The First 3 datatables should be merged and sum up to derive the opening stock as on given period. 4 th datatable is for Purchases done for the given period. The last one Datatable is for Sales done for the given period.
Here is my question: 1. How can i merge the 3 datatables and using the first 2 columns and summing the values? 2. How can i use the tables in crystal reports?
Dim con As New ClassConnection
If con.Conn.State = ConnectionState.Closed Then con.Conn.Open()
Dim sql As String = "SELECT tblBrand.B_ID AS ID, tblBrand.B_Name AS Brand," & _
" Sum (tblOp_Details.Net_Qty) AS Quantity FROM tblOp_Stock INNER JOIN (tblBrand INNER JOIN" & _
" tblOp_Details ON tblBrand.B_ID = tblOp_Details.B_ID) ON tblOp_Stock.Stk_ID = tblOp_Details.Stk_ID" & _
" WHERE tblOp_Stock.God_ID = @GID GROUP BY tblBrand.B_ID, tblBrand.B_Name"
Dim sql1 As String = "SELECT tblBrand.B_ID AS ID, tblBrand.B_Name AS Brand," & _
" Sum (tblPur_Details.Net_Qty) AS Quantity FROM tblPurchase INNER JOIN (tblBrand INNER JOIN" & _
" tblPur_Details ON tblBrand.B_ID = tblPur_Details.B_ID) ON tblPurchase.Pur_ID = tblPur_Details.Pur_ID" & _
" WHERE tblPurchase.God_ID = @GID AND tblPurchase.Rec_Date < @SDate GROUP BY tblBrand.B_ID, tblBrand.B_Name"
Dim sql2 As String = "SELECT tblBrand.B_ID AS ID, tblBrand.B_Name AS Brand," & _
" Sum (tblSales_Details.Net_Qty) AS Quantity FROM tblSales INNER JOIN (tblBrand INNER JOIN" & _
" tblSales_Details ON tblBrand.B_ID = tblSales_Details.B_ID) ON tblSales.Sale_ID = tblSales_Details.Sale_ID" & _
" WHERE tblSales.God_ID = @GID AND tblSales.Sale_Date < @SDate GROUP BY tblBrand.B_ID, tblBrand.B_Name"
Dim sql3 As String = "SELECT tblBrand.B_ID AS ID, tblBrand.B_Name AS Brand," & _
" Sum(tblPur_Details.Net_Qty) AS Quantity FROM tblBrand INNER JOIN (tblPurchase INNER JOIN" & _
" tblPur_Details ON tblPurchase.Pur_ID = tblPur_Details.Pur_ID) ON tblBrand.B_ID = tblPur_Details.B_ID" & _
" WHERE tblPurchase.God_ID = @GID And tblPurchase.Rec_Date >= @SDate And tblPurchase.Rec_Date" & _
" <= @EDate GROUP BY tblBrand.B_ID, tblBrand.B_Name"
Dim sql4 As String = "SELECT tblBrand.B_ID AS ID, tblBrand.B_Name AS Brand," & _
" Sum(tblSales_Details.Net_Qty) AS Quantity FROM tblBrand INNER JOIN (tblSales INNER JOIN" & _
" tblSales_Details ON tblSales.Sale_ID = tblSales_Details.Sale_ID) ON tblBrand.B_ID = tblSales_Details.B_ID" & _
" WHERE tblSales.God_ID = @GID And tblSales.Sale_Date >= @SDate And tblSales.Sale_Date <= @EDate" & _
" And tblSales_Details.S_Active = @SAct GROUP BY tblBrand.B_ID, tblBrand.B_Name"
Dim da As New OleDb.OleDbDataAdapter(sql, con.Conn)
Dim da1 As New OleDb.OleDbDataAdapter(sql1, con.Conn)
Dim da2 As New OleDb.OleDbDataAdapter(sql2, con.Conn)
Dim da3 As New OleDb.OleDbDataAdapter(sql3, con.Conn)
Dim da4 As New OleDb.OleDbDataAdapter(sql4, con.Conn)
da.SelectCommand.Parameters.AddWithValue("@GID", Me.stBar_G_ID.Text)
da1.SelectCommand.Parameters.AddWithValue("@GID", Me.stBar_G_ID.Text)
da1.SelectCommand.Parameters.AddWithValue("@SDate", Me.dtpStart.ToString)
da2.SelectCommand.Parameters.AddWithValue("@GID", Me.stBar_G_ID.Text)
da2.SelectCommand.Parameters.AddWithValue("@SDate", Me.dtpStart.ToString)
da3.SelectCommand.Parameters.AddWithValue("@GID", Me.stBar_G_ID.Text)
da3.SelectCommand.Parameters.AddWithValue("@SDate", Me.dtpStart.ToString)
da3.SelectCommand.Parameters.AddWithValue("@EDate", Me.dtpEnd.ToString)
da4.SelectCommand.Parameters.AddWithValue("@GID", Me.stBar_G_ID.Text)
da4.SelectCommand.Parameters.AddWithValue("@SDate", Me.dtpStart.ToString)
da4.SelectCommand.Parameters.AddWithValue("@EDate", Me.dtpEnd.ToString)
da4.SelectCommand.Parameters.AddWithValue("@SAct", "Yes")
Dim dt As New DataTable
Dim dt1 As New DataTable
Dim dt2 As New DataTable
Dim dt3 As New DataTable
Dim dt4 As New DataTable
Thanks in advance.
|
|
|
|
|
Hai i am Use vb.net 2010, how to compare two datatable and remove the row in one table because same value in two table
my coding....
For i As Integer = 0 To dt_grid1.Rows.Count - 1
Dim found As Boolean = False
For j As Integer = 0 To dtserialleft.Rows.Count - 1
If dt_grid1("BarCode").ToString = dtserialleft("SerialNo").ToString Then
found = True
End If
Next
If found = False Then
dt_grid1.Rows.RemoveAt(i)
End If
Next
please Solve this....
|
|
|
|
|
I think, that you want to remove the row if found=True (not =False as you coded).
What you should know is, that with this command also the rows.count of the dt_grid1 is decreased. Now your loop will do wrong from this point.
In case of found=True you should break your loop, Remove the Row and restart the loop again. If the loop is finished and you got no found=True then you don't need to repaet this.
Could you follow me ?
|
|
|
|
|
|
Whenever you're removing items from a collection within a For loop, you should start and the end of the collection and work backwards. Otherwise, you end up skipping every element following a removed item.
For i As Integer = dt_grid1.Rows.Count - 1 To 0 Step -1
...
Next
You'll also need to specify the row you're looking at when you read the column value:
If dt_grid1.Rows(i)("BarCode").ToString() = dtserialleft.Rows(j)("SerialNo").ToString() Then
found = True
Exit For
End If
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
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.
|
|
|
|
|
The buttons sound like a disaster waiting to happen. Give users a "Force Unlock" button and you're right back where you started.
Do some reading up on locking techniques[^]
If you can't get rid of the VB6 stuff altogether you could also consider a COM dll (written in a .NET language) that you could use to leverage SQL notification services - more info at Query Notification using SqlDependency and SqlCacheDependency[^]
|
|
|
|
|
Will read up on locking.
Seems like locking depends on using transactions which this system doesn't use at all. The entire thing is a jumble that I've inherited and I'm the third generation now I think.
Won't apply it now as I went with the dirties quickest solution that is good enough for now.
|
|
|
|
|
Reading through the description of the system it is quite obvious that it is not suited to multiple access - particularly the deletion and re-insertion of data rather than updates.
There is no manner in which you can 'fix' things that will not cause you a world of pain in the future.
I would say you have 2 options:
(1)Rewrite the underlying database update mechanism so that it does not makes use of deletions and inserts.
(2)Leave things as they are an only allow one user to access the application at a time.
Even if you do go with option (1) there is no solution to the update conflict issue.
Quite simply if two users grab the same record, the person who makes the second update wins - there is no way around this no matter how much clever code you write.
Given that the best minds in computer science have not yet solved this problem there is little chance that you or I will.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
I went with a simple lock that relies a lot on the fact that the users use it the correct way but there are only 3 of them and I only need to reduce the amount of conflicts. Time constraints where I've got to priorities what I do kind of forced me to do what I found the easiest atm.
Now the user wont be able to edit unless they own the lock so to speak and will be prompted to do this and I've gone over all the available functions and added checks to verify correct usage.
Hopefully this will reduce the amount of conflicts. Their problem seems to be compounded by stress when a conflict happens because of their time constraints. If there is one they usually make more shortly there after.
At this point rewriting the entire updating mechanism isn't interesting because in the not so far off future we will change systems and my work now is more to make sure it keeps afloat until that time.
|
|
|
|
|
What happens if a user is booted out of the system while the have the lock?
I guess you have to go in and manually unlock the row(s).Member 11683251 wrote: relies a lot on the fact that the users use it the correct way Good luck with that because in my experience systems need to be written to either guide users or to block them from breaking a system. Relying on users to do things 'the correct way' will lead to the sort of trouble you currently find yourself in.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
The guy that worked here before me had basically given up on user interactions. One part of the system deals with users reporting produced goods and despite numerous checks and controls people still managed to mess it up. One common mistake was that people wrote their userid where you should put the number of goods produced so headed a comparison with their userid was and if it matched with reported goods prompted user to answer if they wanted to proceed. People ended up just clicking yes anyway so instead he just added a big nope can do if they tried to do it.
But I'll put my faith in to that these three can manage a few months.
There is a force unlock available to avoid that and even if that doesn't work this system isn't very safe when it comes to credentials so they could just solve it by exiting and entering again and say that they are the person that owns the lock.
|
|
|
|