|
Thanks for the reply, but I just figured it out. There is another overload for FileStream to set the sharing property so my program isn't trying to do an exclusive open.
<br />
FileStream fs = new FileStream(dr["path"].ToString(), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);<br />
<code>
|
|
|
|
|
Forgive me for a stupid question but how do you read from the SQL backup back into a Access DB?
God Bless,
Jason
Programmer: A biological machine designed to convert caffeine into code. Developer: A person who develops working systems by writing and using software.
[ ^]
|
|
|
|
|
Store the entire .mdb file in an image column and read it out as byte[].
|
|
|
|
|
It's probably not a good idea to do it this way - you really should assert that absolutely nobody is modifying the mdb during your entire read operation. If you're busy copying bytes from the mdb while some guy is saving the mdb, the bytes you get will most likely end up being a corrupted mdb. Some of the bytes you read will be from the "unmodified" mdb, and the rest of the bytes will be from the "newly modified" mdb, and there's no telling which bytes are which.
It'd be best to attempt to open the file for Read access and allow only Read Sharing. If that succeeds, you're guaranteed that nobody can modify the mdb during your copying operation. If it fails, have your program back off, send out some manner of warning (an email or similar), and try again in a few minutes.
"I hope he can see this, because I'm doing it as hard as I can" - Ignignot
|
|
|
|
|
Wouldn't Access itself prevent the user from saving data while another process is reading it? I tried setting FileShare.Read, but I get the IOException.
|
|
|
|
|
eggsovereasy wrote: Wouldn't Access itself prevent the user from saving data while another process is reading it? I tried setting FileShare.Read, but I get the IOException.
Drop back to not specifying any FileShare stuff in the FileStream constructor - that should be the equivalent of FileShare.None. I'm not sure why I suggested FileShare.Read: it won't do you any good, and there may be some goofiness in doing that over a network share. When Access opens the mdb file, I'm willing to bet it opens it with the equivalent of FileShare.None as well, because Access (well, the MS Jet DB engine underneath it all) was never designed to be a multi-user DB system, to my knowledge.
BTW: Typically, you can tell if someone else has the FileName.mdb open by looking for a file named FileName.ldb in the same directory. Access creates the FileName.ldb while it has the FileName.mdb open, and removes it when it closes FileName.mdb. It's not a 100% guarantee, however, because if Access doesn't exit cleanly the FileName.ldb sticks around until someone opens up the FileName.mdb again and exits Access cleanly.
"I hope he can see this, because I'm doing it as hard as I can" - Ignignot
|
|
|
|
|
Hi all
I hv used a repeater to display panels on my form. I am using CollapsiblePanelExtender(ASP.NET AJAX 1.0) to expand or collapse the panels generated by the repeater.
My problem is in one of the panels i hv used a linkbutton.on click event of linkbutton i want to access the text of linkbutton, but whn i click the linkbutton client-side coding of collapsible panel gets called n i can't access server side coding of repeater_ItemCommand event.
Plz can anyone help me out...
|
|
|
|
|
I'm looking for information on the right way to draw to two different windows using a single DirectX device. The biggest key is
device.Present(overrideWindow)
but SwapBuffers also seem to be involved, and perhaps the Viewport settings may make a difference.
I'd appreciate pointers to a good resource, comments, or suggestions. Working source code, of course, is even better.
- - - -
further detail:
I am currently drawing one window with 2 viewports and Present() it. Then I draw the other window with a single viewport and Present(win2) it. The second window's viewport size gets misinterpreted, somehow, and it doesn't fill the second window even though it is explicitly set to use the window's full width and height. The first window's display is (not suprisingly) duplicated in the region not filled by the viewport on the second window. Drawing withing the viewport on the second window is correct. I do not have a separate SwapBuffer for the second window, since it doesn't seem necessary, and it is unclear to me what benefit it would provide.
- - - -
Mark
|
|
|
|
|
Hi,
I have a basic command line application and I want to store a username and password it can use to access a web service. Is there a simple way of doing this using System.Configuration ?
Also I'd like to store my password in an encrypted format. Is there some way of doing this?
Thanks
|
|
|
|
|
|
I often have trouble with class names because I am very pedantic in nature. Two days before deadline I should not be worrying about this at all, but I am. I often get uncertain naming classes that perform only one task, such as one I have now that submits a document to a web service. I don’t favour the clumsy sounding “DocumentSubmitter”, and “DocumentSubmit” sounds much better, but now my class name is no longer a noun. Are there any guidelines on this?
|
|
|
|
|
|
DocumentSumissionHandler?
Isn't there a Document class? Couldn't the document submit itself, removing the need for a special class for it?
---
single minded; short sighted; long gone;
|
|
|
|
|
No, I am of the design school that doesn't permit the document knowledge of the submission process[1]. This allows diverse submission channels without impacting the document. In this I could use your name or DocumentSubmissionEngine, to stick to the noun guideline, but these seem overly verbose, and the Handler suffix may incorrectly hint at a callback method.
[1] On something of a tangent, my favourite example of this debunks the popular OO example where a Customer knows how to Save itself. A real world customer is not aware of how the bank stores his details, nor of how the library stores his details. He is only aware of his details and how to derive certain facts from them.
|
|
|
|
|
Hi All
I have an application which requires me to use the PC com port to communicate with a PIC (16f877) micro-controller. I am planning to use the PC to fill a serial EEPROM with data which constitutes a digitized waveform of 100 samples. In other words the program on the PC needs to take in a text file which holds the values for 100 samples (in hex string/decimal string?) and transmit them on command to the PIC. The pic then takes the data and fills each address in the attached serial EEPROM with a sample value. So for instance, each sample can be between 0x00 and 0xFF (0 to 255) and I need to transmit it as a single byte so the PIC can deal with it.
In the past I have used outportb quite successfully. However, I am now using C# in Visual Studio 2005 and I was wondering if anyone has any suggestions how I can do the same/equivalent? I am having some trouble converting from a string to a byte... What I mean by this is that if the string is 255, I can only convert to a byte array which gives me a byte for 2, then 5 then 5..... What I really want is the byte equivalent to 255 (ie 1111 1111)... I hope this makes sense...
Any help would be gratefully appreciated.
Jamie
|
|
|
|
|
Try the Byte.TryParse method.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thanks for that.... On first look it does seem to do what I want. It's amazing how the simple things can cause so much trouble..... Now I just need to re-visit some assembly language to get my graphical display working correctly......
Cheers
Jamie
|
|
|
|
|
Hi,
you need SerialPort.Write Method (Byte[], Int32, Int32) to output arbitrary bytes,
and if your source is a text file with decimal numbers, then a loop containing
byte.TryParse() is the way to go.
If your string input is using hex, then you need NumberStyles.AllowHexSpecifier in
byte.TryParse()
|
|
|
|
|
Hi,
Heres a sample XML document:
<?xml version="1.0" encoding="utf-8"?>
<Sample>
<Name>
<!--Indicates the first name-->
<FName>A</FName>
<!--Indicates the Middle name-->
<MName>M</MName>
<!--Indicates the last name-->
<LName>B</LName>
</Name>
<ID>1</ID>
</Sample>
If i get the count of childnodes of the node <name>, using the following statement: xmlNamenode.Childnodes.count, it returns 6 (i.e) it also includes the comments as a child node. Is there any way to directly get the count of number of elemets (excluding comment nodes) instead of alll the childnodes?
Thanks in advance
Regards
Madhu
|
|
|
|
|
Xml naming convention is camelCase element names.
...
Use XPath. I believe there are several sample queries on the web that will give you the exact results you are looking for.
File Not Found
|
|
|
|
|
hi i want to acces a textbox text in the class file
wat i have to to do to get the values from forms in class
thanks
with regards
Balagurunathan.B
|
|
|
|
|
Please Help!
I have created a class:
using System;
using System.Data.SqlTypes;
using System.IO;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Server;
namespace mySQL
{
public class SQLCLRIO
{
public static void WriteToFile(String content, String filename)
{
SqlPipe sqlP = SqlContext.Pipe();
try
{
File.WriteAllText(filename, content + "\n");
}
catch (Exception ex)
{
sqlP.Send("Error writing to file : " + ex.Message);
}
}
}
}
The problem is when I try to compile it into a dll I get the following.
"Microsoft.SqlServer.Server.SqlContext.Pipe' is a 'property' but is used like a 'method"
Illegal Operation
Making Computer Software Talk
|
|
|
|
|
remove the () at the end of the Pipe. You only have those if you are calling a method.
Ben
|
|
|
|
|
Remove ()
---
single minded; short sighted; long gone;
|
|
|
|
|
Hello everybody.
I am working with MVS2005.My project is C# project
How can I make e table with 10 raws and 10 columns and draw a moving ellipse over table.
Thanks for all.
|
|
|
|