|
On top of all that, it still needs a DOS partition to boot and still relies on 16-bit code in it's kernel.
Won't be fixed until NetWare 8 with a complete rewrite of the kernel, if the company survives that long...
RageInTheMachine9532
|
|
|
|
|
Hello
I have to read an excel sheet from asp.net using C#.i do hold a code minus using the Excel Object.
This is my code..
What i need to know from the following code is that The Sheet1$ which i am querying from need not go always under the name Sheet1$.i need to find a way to read the Excel Sheet Tab Names instead of referring them by hardcoding as Sheet1$
Kindly advise.itz very urgent.
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + Server.MapPath("./") + "\\uploadedfiles\\Fortek CIS1.xls;Extended Properties=Excel 8.0;";
System.Data.OleDb.OleDbDataAdapter myData=new System.Data.OleDb.OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn);
myData.TableMappings.Add("Table", "Fortek CIS1");
DataSet myDataset=new DataSet();
myData.Fill(myDataset);
int j=0;
while (myDataset.Tables[0].Rows.Count>0)
{
if (j==43)
break;
Response.Write(myDataset.Tables[0].Rows[j+1]["name"] + "---------");
Response.Write(myDataset.Tables[0].Rows[j+1]["dept"] + " ");
j=j+1;
}
|
|
|
|
|
You'll have to use the Microsoft Office PIAs (Primary Interop Assemblies). If you are using Office 2002 (XP), you can download them from http://www.microsoft.com/downloads/details.aspx?FamilyId=C41BD61E-3060-4F71-A6B4-01FEBA508E52&displaylang=en[^]. If you're using Office 2003 Professional or Developer you can get these from the CD. They are not downloadable unless you're an MSDN Subscriber, though. In that case, however, you can actually use the XP PIAs because the supported interfaces are backwards compatible, at least for the functionality you need.
In your code, create a new instance of the ApplicationClass and use ApplicationClass.Workbooks.Open to open your file. You can then enumerate the Sheets property to get the name. Make sure to close the workbook and call ApplicationClass.Quit when done. If you design an effective caching system, you could save yourself a big performance hit by remembering which files have which worksheets if you know they won't change.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
Can we get the exe path using C# calls??
I am getting only the special folders path, (like program files, programs, etc). How to get the user created folder paths??
Thanks and Regards,
Satya Prasad
|
|
|
|
|
Application.StartupPath ?
|
|
|
|
|
Hi,
I have started the application like this in a Service called myservice.
Process myapp=Process.Start("application path");
Now I want to get the application path (which is hard coded) through the program.
With myapp how to find out the path of the exe.
Regards,
Satya Prasad
|
|
|
|
|
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents=false;
proc.StartInfo.WindowStyle=System.Diagnostics.ProcessWindowStyle.Hidden;
proc.StartInfo.FileName=Environment.CurrentDirectory+"\\myexe.exe";
proc.StartInfo.Arguments=myargumentstring; //if u have arguments
proc.Start();
|
|
|
|
|
Hi,
Sorry I think my question is not clear.
I have some process which starts some exe's.
Now I am hard coding those exe's names.
What I want the program should get the complete path of the exe and start those exe. Because these exe can be installed anywhere, If I hard code it creates problem. As you said Environment.CurrenDirectory it gives only the process's current directory not the exe's directory which I want to start.
Is there any way to get that path of exe.
Thanks and Regards,
Satya Prasad.
|
|
|
|
|
SatyaDY wrote:
Sorry I think my question is not clear
No kidding....
SatyaDY wrote:
Because these exe can be installed anywhere, If I hard code it creates problem.
You need some way of determining where those .EXE's are? Did you install them as part of your package? If so, then you could generate an .INI file listing the locations of the .EXE's. Your service could then read that .INI file to get the path to the .EXE's you want to launch. If not, your going to have to come up with a way to find these .EXE's and create an .INI file that can be used by your service. Possibly asking the user where they are? Or writing code to hunt them down? It's up to you...
Another method, although less reliable and surely more problematic, would be to write code that searches the drive for the .EXE names you want, then launch them. I think you can see the security and reliability problems with that approach...
RageInTheMachine9532
|
|
|
|
|
When executables are in directories listed in the PATH environment variable, they can be executed without specify a directory. If they aren't in the path (including the current working directory), then you need to know where they are up-front like Dave said.
If the executable is in the PATH and you still want the full path, use Environment.GetEnvironmentVariable for "PATH", then use String.Split to split the paths into a string[] array using ";" as the delimiter. You can then search those paths in order to find all the paths to the executables.
If they aren't in the PATH, then you should either store the paths in the registry or some common file during installation, or creating an RCW (Runtime Callable Wrapper) around the MSI runtime (if you used Windows Installer for your installation of these programs) and query for the executable's component path.
There's no automagical way to get this information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
since now I used sonething like this:
System.IO.FileInfo fi = new System.IO.FileInfo(Application.ExecutablePath);
GlobalContainer.ExecutablePath = fi.DirectoryName;
fi = null;
Help states:
Property Value
The path and executable name for the executable file that started the application.
Caveeat: You need to reference System.Windows.Forms.
-sa
--
http://www.livingit.de
http://www.mobile-bookmarks.info
http://www.not2long.net
|
|
|
|
|
Hello,
I have added the user control to a form. How do I listen for form resize event inside my user control. i.e When ever form is resized, i need to resize the user control also. I dont want to use docking property of user control.
I tried with the below statement:
private void InitializeComponent()
{
//.........
this.TopLevelControl.Resize +=new EventHandler(TopLevelControl_Resize);
}
But this is throwing NullRefrenceException - Object reference not set to an instance of an object.
Is there any other way?
Thanks & Rgds
Jayakarthikeyan.S
|
|
|
|
|
Try the Anchor property of the control.
RageInTheMachine9532
|
|
|
|
|
Hello,
Anchor property does not resize the control and location is getting changed.
Here i want control to be resized along with the form. When the form is resized larger and once control reaches its default size then control should stop resizing.
Thanks & Rgds
jayakarthikeyan
|
|
|
|
|
jayakarthikeyan wrote:
Anchor property does not resize the control and location is getting changed.
Wanna bet?
That's exactly what the anchor property does. It anchors one of more sides of the control to the side of its container, in your case the form.
If you select all four sides of the Anchor property, then the controls top left corner will be pinned in place and the bottom right corner will be moved to keep the same distance from the bottom right corner of the form. If you select just the top and left sides, then the control will maintain its position and not resize. If you select just the bottom and right sides, the control will not resize but will only move to keep it's position relative to the bottom right corner of the form.
The bottom line is if you select two opposite sides to Anchor, the control will resize itself to maintain those two edges relative to the sides of the form. If not, then the control will move to maintain its relative position to the edge that is selected.
To get the minimum size, use the MinimumSize property of the FORM, not the control. This way your form cannot be resized so small that the controls on it get so small that they are useless.
Your only other alternative is to override the Anchor property of the control and supply the resizing code yourself. BTW: What do you mean by "reaching it's default size"? The control can resize, but only within a certain range? Does it have to maintain a minimum and/or maximum size? If that is the case, then you WILL have to override Anchor and supply the resize code yourself.
RageInTheMachine9532
|
|
|
|
|
Thanx Dave. It's resizing when form is resized.
Jayakarthikeyan
|
|
|
|
|
You can also use the Dock property with DockStyle.Fill besides anchoring, but Dave's right - anchoring is used for this very purpose and gives you more control than docking in many cases.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'm looking for a design pattern that allows for volatile interface changes to meet the needs of varying demands. Basically I have a project where abstractions will be relatively stable but, the actual implementations will vary. I've thought about using the bridge pattern but, I'm not sure if thats the best idea. If anyone has any suggestions they would be greatly appreciated.
|
|
|
|
|
I have seen some .NET code on the web that uses the Microsoft.Win32.Win32Native class. However, whenever I try to use it I get a compiler error (#CS0122) saying that it is inaccessible due to its protection level. How can I get access to it?
Thank you,
Ray Gregory
|
|
|
|
|
The Win32Native class is internal . This means that those methods and members are only visible to that particular assembly, not to your code.
- Nick Parker My Blog | My Articles
|
|
|
|
|
This error appears when i decrypt the message that is read from a file. The message in this file is encrypted. Before encrypting the message, this message is Xml data that read from a xml file.
What is the meaning of this error ? Thanks for help
Mscorlib (in Mscorlib.dll)
at System.Security.Cryptography.CryptoAPITransform._DecryptData(IntPtr hKey, Byte[] rgb, Int32 ib, Int32 cb, Boolean fDone)
at System.Security.Cryptography.CryptoAPITransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
at System.Security.Cryptography.CryptoStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at WindowsApplication3.Form1.button10_Click(Object sender, EventArgs e)
|
|
|
|
|
This message is not complete part of your exception. It only say where does exception happen but you didn't send error message and your code so we can help yu more.
Mazy
"Man is different from animals in that he speculates, a high risk activity." - Edward Hoagland
|
|
|
|
|
Actually, there was no exception being thrown.
If you have seen the code ... the try-catch is something that i insert to see what thing is happening ...
This is because ... the program was hanged in the do loop ...
I don't know how to express ... if you have tried the code, you will know what is happening...
Things made me mad ...
Anyway, thanks for your reply ...
i still look forward you can help me to solve this problem ....
|
|
|
|
|
how to scan a barcode and input it to my c# code
how to know information about all this senario?
|
|
|
|
|
Reading barcodes from documents that have been printed with some kind of symbology is a kind of micro-specialization. There are several different kinds of symbols used (UPC, EAN, Interleaved 2 of 5, Code 39, etc.) in which barcodes are produced by printing on laser printers, barcode label printers, dot matrix printers, etc... and then you have readers (wands, scanners, etc.) that are either serial or keyboard wedge readers. The latter -- keyboard wedge -- are easier to use, and often plug and play. A decent reader will cost between US$100 and US$200 and should be programmable to read different symbols, look for check digits, etc. Once you have a reader, you can get the result into a text box just as though someone had typed the information using a keyboard.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|