|
Theading has nothing to do with concurrency issues in the database. This question is not answerable, as you've posted it.
Concurrency is a situation that your app must handle according to your business and data rules. Noone can tell you how to write an "all encompassing solution" to a problem you haven't explained yet.
Locking a table is NOT a good option since noone will be able to read that table until it's unlocked. This too will genereate it's own set of problems for your app. If you wanted to kill your SQL server's performance from your applications point of view, this is the way to do it.
From your description, it looks like you don't have a firm grasp of what data concurrency is, what situations cause concurrency violations, nor do you understand what your options are in handling various concurrency issues and what the implications are for each solution. I highly suggest reading up on data concurrency before you start throwing locks around that you really don't need.
Think about this situation. Say one copy of your app places a lock on the table, then crashes. When does the lock get removed??
You can read up more on Data Access and Concurrency issues in this[^], this[^], and these[^].
|
|
|
|
|
Hi!
I've the following problem:
I've two bitmap variables, and I want to check that they contain the same image or not.
If I try to use the "=" operator, I get an error message.
I wrote a function what examines every pixel (by setpixel and getpixel methods), but it makes the program very slow.
Isn't there a faster way?
Thanks in advance.
|
|
|
|
|
Because VB sucks, no. But, if you did this in C# and called it from a dll, you could use direct pixel access, like I do in my image processing articles, which would be faster.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
Yes I had the same problem with get/setpixel. Here is what you do, create a file stream for each file then compare the file streams.
If you need an example just let me know (don't worry it's real simple). I don't have the exact commands for it memorized but I have code for something similar on my laptop and I can give it to you later if you want me to.
|
|
|
|
|
I'll be very grateful if you send me the code.
Much thanks
|
|
|
|
|
A few notes. This will compare 2 files of ANY format not just bitmaps. path1 and path2 are your file paths. This will only work if the files are the same format(if you compare a 32 bit and 24 bit bitmap it will always return false). Also I have not tested this but I think it is correct but if you get an error or problem just let me know. I don't think there is much overhead with filestreams but if it isn't real fast then try using the read command at the bottom to read it into arrays then compare the arrays instead of the filestreams. If you need to compare different formats or if you are looking for a way to get or set pixels then I know how to do that but it is a little more involved than this since you have to match up pixels and so forth and it requires some knowledge of the bitmap format.
Public Function CompareFiles(ByVal path1 As String, ByVal path2 As String) As Boolean<br />
Dim n As Integer, issame As Boolean = True, fstream1 As IO.FileStream, fstream2 As IO.FileStream<br />
<br />
'create streams<br />
fstream1 = New IO.FileStream(path1, IO.FileMode.Open, IO.FileAccess.Read)<br />
fstream2 = New IO.FileStream(path2, IO.FileMode.Open, IO.FileAccess.Read)<br />
<br />
'compares the streams<br />
If fstream1.Length = fstream2.Length Then<br />
For n = 0 To fstream1.Length<br />
If fstream1.ReadByte <> fstream2.ReadByte Then<br />
issame = False<br />
Exit For<br />
End If<br />
Next<br />
Else<br />
issame = False<br />
End If<br />
<br />
fstream1.Close()<br />
fstream2.Close()<br />
<br />
Return issame<br />
End Function
The file stream is basically like an array of bytes. You can manipulate any file with file streams and if you want to copy data to or from an array use these commands.
fstream1.Read(yourarray, youroffset, yourcount)<br />
fstream1.Write(yourarray, youroffset, yourcount)
|
|
|
|
|
Thanks
|
|
|
|
|
Hello every one
I am developing a VB 2005 Express. At times it happens that the connection to the server breaks. I want to give a option of retry, and connect to the server again
- But even after the network is up then also I am not able to access the server
- Also which is the exact Exception to be used when there is not network connection
|
|
|
|
|
Sounds like you have network issues, not issues in your code.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
may be that is the case...
but i find the network working for other applications...
i am trying to test the application on network..
I happens that when the network drops due to some reason the application gets stuck..
so i was trying to get a solution like
- stop for some time and try again.
- when i was testing that condition i found even when the network comes back the application is not connecting...
i do not know what to do...
The only way application will work is to restart it, as of now..
What else can i try?
|
|
|
|
|
Your problem sounds that you have a application install at one terminal and then you are trying to use the database available on some remote system that could be a system available on LAN.
This error occor due to windows firewall go to the control panel of the server open the window firewall option and turn off it i think it will help you out
With Regards
Yogesh Agarwal
|
|
|
|
|
If the issue is with fire wall then how can i get the application running in the first pace??
|
|
|
|
|
Hi,
I get the following error while installing application built by
Installshield XI. I am using CR-XI
Error 1904.Module C:|Program Files\Common Files\Business
Objects\3.0\bin\craxdrt.dll failed to register. HRESULT -2147024770. Contact
your support personnel.
************
I try to double check all the independencies and even add all related CR-XI dll's
but then i always got that kind of error when i try to install my software i've made..
its freaken me out... i dont know what to do.. please anybody can help...
please anybody??
*********
Thank you in advance
modified on Thursday, December 20, 2007 3:18:58 AM
|
|
|
|
|
Hi
This problem occurs because using installshield didn't include the supporting dll and ocx required for the report printing this error occor when you try to view the crystal report in your application. to solve the problem you must include the runtime redistributble version for crystal report into your setup script.
hope this will help you out
with regards
Yogesh Agarwal
|
|
|
|
|
Thanks a lot for your help.. ahehe
silly me... ahehe i forgot to include the crystalreport11_5_rdc_runtime merge module..
for me to support the module dependencies...
ahehehe...
thanks again...
|
|
|
|
|
I am reading a csv file and showing the data in the grid by with the following code
Dim oCon As OdbcConnection ', oDS As New DataSet
ods = New DataSet
'Dim oDA As OdbcDataAdapter
Dim sConString As String
' Dim sFolder As String
' Dim sFile As String
'Folder where csv file is located
sFolder = "C:\"
'csv Filename
sFile = "Template.csv"
sConString = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" & sFolder & ";"
oCon = New OdbcConnection(sConString)
oda = New OdbcDataAdapter("Select * From [" + sFile + "]", oCon)
oda.Fill(ods)
dtGridFile.DataSource = ods.Tables(0).DefaultView
Now the problem is that I have one field with contains '0000' but it is showing only '0' in the grid and when I try to run the query on the bases of this field it does not return the records becoz In dataset it is only '0' while in database field contains '0000'.
How I can get have the same values in the dataset as I have in csv file?
Thanks in advance
|
|
|
|
|
You need to "explain" to the code that '0000' is a string and not a number.
You could try it by adapting the sql, something like this:
"Select CAST(YourQuadrupleZeroField AS NVARCHAR(4)) as YourQuadrupleZeroField From [" + sFile + "]"
Remember that the 4 should be the maximum possible length (number of characters) of that field.
Hope it helps,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
The field containing '0000' is a varchar field.I am using Oracle database.
I need to read all the fields not only one field so that's why using
"Select * from [" + sFile + "]"
There are more than 25 fields in the file.
|
|
|
|
|
No matter what you should still explicitly specify the columns you want returned from the SELECT statement for performance reasons. That being said, how your database table is defined is completely irrelevant to your problem. The problem is happening when you create the ODBC connection to the CSV file. Since the field in question contains numeric data, the Jet engine is treating it as a numeric field. (If you look at the column properties for the DataTable that was created for you, it should show that the column is a numeric data type.)
You need to explicitly convert the column to text data in your SELECT statement by casting it or create a schema.ini file that defines the column data types. See http://support.microsoft.com/kb/187670[^] for more information on the schema.ini file.
|
|
|
|
|
Using an MDI form, it's easy to set up a row or column of buttons to the side of the client area. Is there any nice way to use a splitter so the user can resize the client area (assuming the buttons can resize themselves to their container)? The splitter control is very nice for most such purposes, but I don't see any way to set one of the panels to behave as the MDI client area. Is there any nice way to do so, short of using a fake splitter control and using click/mousemove events to force-resize the button bar?
|
|
|
|
|
It's possible to do, but not easily. On an MdiParent form, there is a control that's automatically put on the form which handles all of the MdiChild windows and provides a place to render them. This control is a class, just like any other control on the form, called MdiClient. Since it is a control, deriving from the Control class, it behaves just like any other control. All it needs is a parent container to render itself in. By default, the MdiClient control is added to the MdiParent form's Controls collection. All your code has to do is find the MdiClient control and give it a new parent container, such as one of the Panels of a Splitter container.
There is a problem with this though. Any NEW instances of a form that you want to add to the MdiParent won't work unless you move the MdiClient control BACK to the MdiParent form's Controls container. What this means is that while you CAN put the MdiClient control on the right side of a splitter, you cannot add any MdiChild forms to it until you move the MdiClient back to where you found it, add the form, then move the MdiClient back to the right-side panel of the splitter.
Why? Because once you move the MdiClient from the Controls collection of a Form, it's no longer considered an MdiParent form and cannot be used to set the MdiParent property of a new form instance.
There might be a way around this, but I'd have to test it before I say anything.
|
|
|
|
|
I have a directory tree control which uses a Try/Catch stmt. As the code loops through file fodlers, the Catch picks up on the fact that I am trying to access a Norton (Symantec) folder which I do not have access to on my C Drive. I need to find a way to error handle the code so that it progress and continues to populate my Tree Control. The way it works now is it prompts the user with an error message and then the code stalls.
Private Function GetDirectories(ByVal PathIn As String, ByVal NodeIn As TreeNode) As Boolean
Dim HasFiles As Boolean = False
Dim MyNode As TreeNode
Dim MyDirs() As String
Dim LocalPath As String = Nothing
Try
MyDirs = Directory.GetDirectories(PathIn)
For Each Item As String In MyDirs
MyNode = New TreeNode(PathIn & "\" & Item)
HasFiles = Me.GetDirectories(Item, MyNode)
If HasFiles Then
NodeIn.Nodes.Add(MyNode)
End If
HasFiles = Me.GetTextFiles(PathIn, NodeIn) Or HasFiles
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
Return HasFiles
End Function
Thanks
EM
|
|
|
|
|
Okay, so the proper way to do this would be to check whether you have access to a directory, before adding it to your tree. However, I personally don't know how to do that, so I suggest you simply use an inner try-catch clause. In other words, step through your app in debug mode, determine at which point exactly the error is thrown, and put just that sentence, or block of code, in its own try and catch block, such that the try catch block is nested inside the loop.
My advice is free, and you may get what you paid for.
|
|
|
|
|
hi every body,
i want to learn how to create user control and set property and events
Ahmed hassan
|
|
|
|