|
.NET runs on NT4 SP6a. However, I don't think you can host the Visual Studio .NET on NT4. Or, if you can, some web functionality will not be available IIRC.
Kevin
|
|
|
|
|
hi
I want to import a CSV file using .NET
i am using the following line for connection string
conn_csv_str = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + Path.GetFullPath("../../UPS");
this works fine and my application si working also, however it ignores the first line, becasue it assumes that its the header. where as i want to read from a csv file that does not have a header, can anyone help me out on this.
Vandan
|
|
|
|
|
You might try the Jet OleDb driver instead. The connection string should look like the following:
conn_csv_str = "Provider=Microsoft.Jet.OleDb.4.0; data source=" + Path.GetFullPath("../../UPS"); Extended Properties=\"Text;HDR=NO; IMEX=1;FMT=Delimited;\""
HDR states whether there is a header or not.
|
|
|
|
|
Hello, I have a .Net executable that calls a .Net Dll, which is strong named and registered in the GAC, so it won't have to be in the same directory as the executable.
I made some changes in the Dll (but didn't alter the methods headers) and recompiled it with the same StrongName Key.
Then I tried to replace the old Dll with the new one, both in the Dll directory and in the GAC. But now the executable doesn't recognize the new Dll!
Any help?
Thanks.
|
|
|
|
|
If you didn't change the version number, GACUTIL won't do anything. It looks at the metadata, says 'yup, I've already got that one' and doesn't overwrite. The same is true for any other methods of updating the GAC (since the work is done by fusion.dll - all methods of updating the GAC wrap fusion.dll).
You need to remove from the GAC first.
Note that you shouldn't issue a new DLL with the same version, culture and strong name key as before. You're supposed to either use Publisher Policy (yuck) or configuration (slightly less yuck) to redirect from the old version to the new, if required.
If the DLL is tied closely to a particular project, you should not use the GAC. IMO, the GAC is overused. You should only use the GAC if you have a shared DLL that you won't control all the clients of. It's generally safer and cleaner to stick to keeping private DLLs - not strongly named - in the same directory as the executable, or in a dll directory below the executable's directory.
You may feel that you need to have certain fixes apply to all clients of your DLL. If you've been able to test the changes to all clients sufficiently, go ahead. But it's generally safer to stick to using the version that the executable was tested with, and update the whole package if a bug is found.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi. Thanks very much for your advice.
I will describe the steps of what I did in more detail:
1- Compiled the Dll with a strong name key file, and version set to '1.0.*' (what happens here is that the version number changes everytime I compile)
2- Copied the Dll to 'c:\Components\MyComponent.dll'
3- Registered the 'MyComponent.dll' in the GAC
4- In the Client project I added a reference to 'c:\Components\MyComponent.dll'
5- Compiled the Client project and copied it to 'c:\Programs\MyProgram.exe'
(At this point all things work properly. A few days later I needed to do some changes in the Dll component)
6- I changed some lines of code in a method of the Dll project, then recompiled it (thus generating a new version number) with the same strong name key file.
7- Removed the old Dll from the GAC and deleted the file 'c:\Components\MyComponent.dll'.
8- Copied the updated Dll to 'c:\Components\MyComponent.dll' and registered it in the GAC.
(Now, from this point the client program at 'c:\Programs\MyProgram.exe' stopped working, saying it doesn't find the component.)
This component is to be shared between different applications, and I decided to put it in the GAC so I wouldn't have to copy it to all the applications directories everytime there is a change in the component.
I expected it was enough to just update the Dll from the 'c:\Components' directory and the changes would reflect to all applications that use it.
Am I missing something here?
|
|
|
|
|
When a program or DLL references a strongly-named DLL, all components of the DLL's identity are recorded - assembly name, version number, culture, and public key token. Only that version of the DLL will be loaded.
The GAC can contain multiple assemblies with the same base name if they have different version numbers, cultures, and/or public key tokens. That last allows different vendors to use the same base name independently, although this will be pretty confusing to a user!
When loading a strongly-named DLL, the GAC is searched first, then the application's directories. See How the Runtime Locates Assemblies[^] for more.
To cause a different version of an assembly to be loaded from that listed in the referencing assembly's manifest, you have two options: Publisher Policy[^], or <assemblyBinding>[^] elements in the application's configuration file. The former allows all uses of an assembly to be directed to a new version, but the documentation is a bit unclear. The latter has to be applied to every executable that will use the updated assembly.
I'll reiterate that for components that aren't going to be released to third-party developers, I'd recommend keeping your class library assemblies private, without strong naming. If the assembly isn't strongly named you can overwrite without regard to version numbers. It does make deployment slightly more difficult, since you have to copy the updated assembly to the directories of every application you want to use it, but then you should probably only update those applications which are experiencing the problem you've fixed in the newer version of the assembly.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
client socket based app is in VB6 and server socket based is in VC++.NET.
Prob is i am doing encryption in VB6 and convert that encrypted byte array to string using copy memory.
when I get that data over socket , using UTF7 encoding,it have question marks and result is i cant do decryption on this data. for example VB6 send data like this.
Rê—ì:Eaœ!ƒcêÕ½2A€ ;ŽîOv|¼¤iN<ýåü4=ŠË¹¿•ðµ_ìq¾”&
then at VC++.NET it will b like this
Rê?ì:Ea♂§?!?cêO½¶2A? ;?îOv|¼?☼iN<→yåü4=?∟E1¿?▬?d↔µ←_ìq_?&
Please anyone can solve this problem. yr help wud be appreciated.
thanx
|
|
|
|
|
Strings in VB are basically BSTRs and strings in .NET are managed classes with lots of extra info attached to unicode char array. You could receive the encrypted data in an unmanaged buffer in C++.NET side, decrypt it and then marshal it into the managed side.
Farhan Noor Qureshi
if (this == this) thow this;
|
|
|
|
|
Thanx for yr reply.
on .NET side i am getting data in BYTE so i send this BYTE data as it is to decrypt function.but still problem persists.
is there anyway to workout this buffer BYTE. this is of managed type.
yr reply wud be really appreciated
|
|
|
|
|
Post some code.
I think the problem might be,
1. in using strings
2. in encoding UTF-7
Can you try with base64? http://en.wikipedia.org/wiki/Base64[^]
Farhan Noor Qureshi
if (this == this) thow this;
|
|
|
|
|
I tried base64 with no joy.......... 
|
|
|
|
|
Hello!
Usually I show errors to the user by handling the Application.ThreadException event. This works fine for the button1_Click() method (message box appears) but I do not get a message box from the DragDrop handler (see code below). Why?
public partial class Form1 : Form
{
public Form1() {
InitializeComponent();
textBox2.AllowDrop = true;
Application.ThreadException += OnThreadException;
}
void OnThreadException(object sender, ThreadExceptionEventArgs e) {
MessageBox.Show(e.Exception.Message);
}
private void button1_Click(object sender, EventArgs e) {
throw new ApplicationException("button1_Click");
}
private void textBox1_MouseDown(object sender, MouseEventArgs e) {
DoDragDrop(sender, DragDropEffects.All);
}
private void textBox2_DragEnter(object sender, DragEventArgs e) {
e.Effect = e.AllowedEffect;
}
private void textBox2_DragDrop(object sender, DragEventArgs e) {
MessageBox.Show("I'm here!");
throw new ApplicationException("You'll never see this :-(");
}
}
-----------------
Alex
|
|
|
|
|
|
Darn! Trotzdem Danke...
(BTW the link says it's not a bug but a feature.)
-----------------
Alex
|
|
|
|
|
I have the code of an old C library that acts as a very basic add-on module for FS (MS Flight Simulator). Since I'm just a simple .NET developer I have no clue how to convert this code into .NET code, in a way it still is compatible with FS. I thought the best solution was to convert it into a managed C++ library, and include this library in my C# project. However, since I'm not a very experienced C/C++ developer I don't know how to do this. Converting it directly into C# code would be perfect, ofcourse, but I don't know if that's possible.
Is this possible at all? Maybe someone can point me in the right direction? I would be very grateful!
This code just adds a menu item to the FS menubar.
The header file:
<br />
#ifndef __FS_MODULE_H__<br />
#define __FS_MODULE_H__<br />
<br />
#define DLLEXPORT __declspec(dllexport)<br />
#define FSAPI __stdcall<br />
<br />
<br />
typedef struct _MODULE_IMPORT {<br />
struct {<br />
int fnID;<br />
PVOID fnptr;<br />
} IMPORTSentry;<br />
struct {<br />
int fnID;<br />
PVOID fnptr;<br />
} nullentry;<br />
} MODULE_IMPORT;<br />
<br />
<br />
typedef struct _MODULE_LINKAGE {<br />
int ModuleID;<br />
void (FSAPI *ModuleInit)(void);<br />
void (FSAPI *ModuleDeinit)(void);<br />
UINT32 ModuleFlags;<br />
UINT32 ModulePriority;<br />
UINT32 ModuleVersion;<br />
PVOID ModuleTable;<br />
} MODULE_LINKAGE;<br />
<br />
#endif /* __FS_MODULE_H__ */<br />
The main file:
<br />
#include <windows.h><br />
#include "module.h"<br />
<br />
<br />
DLLEXPORT MODULE_IMPORT ImportTable = {<br />
{0x00000000, NULL},<br />
{0x00000000, NULL}<br />
};<br />
<br />
void FSAPI module_init(void) {}<br />
void FSAPI module_deinit(void) {}<br />
<br />
DLLEXPORT MODULE_LINKAGE Linkage = {<br />
0x00000000,<br />
module_init,<br />
module_deinit,<br />
0,<br />
0,<br />
0x0900,
NULL<br />
};<br />
<br />
WNDPROC oldWndProc;<br />
<br />
HWND hFSimWindow;<br />
<br />
#define MENU_ENTRY "My Mo&dule"<br />
#define ID_MY_MENUITEM 40001<br />
<br />
<br />
LRESULT CALLBACK FSimWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)<br />
{<br />
switch (uMsg) {<br />
case WM_NCPAINT:<br />
{<br />
HMENU hMenu, hMyMenu;<br />
<br />
hMenu = GetMenu(hwnd);<br />
if (hMenu != NULL) {<br />
int i;<br />
for (i = 0; i < GetMenuItemCount(hMenu); i++) {<br />
char buf[128];<br />
GetMenuString(hMenu, i, buf, 128, MF_BYPOSITION);<br />
if (strcmp(buf, MENU_ENTRY) == 0) {<br />
break;<br />
}<br />
}<br />
if (i < GetMenuItemCount(hMenu)) {<br />
break;<br />
}<br />
<br />
hMyMenu = CreateMenu();<br />
AppendMenu(hMyMenu, MF_STRING | MF_ENABLED, ID_MY_MENUITEM, "My &First Menu Entry");<br />
AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT_PTR)hMyMenu, MENU_ENTRY);<br />
}<br />
}<br />
break;<br />
case WM_COMMAND:<br />
if (LOWORD(wParam) == ID_MY_MENUITEM) {<br />
MessageBox(hwnd, "It works!", "HURA", MB_OK | MB_ICONEXCLAMATION);<br />
return 0;<br />
}<br />
break;<br />
}<br />
return CallWindowProc(oldWndProc, hwnd, uMsg, wParam, lParam);<br />
}<br />
<br />
<br />
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)<br />
{<br />
switch (fdwReason) {<br />
case DLL_PROCESS_ATTACH:<br />
hFSimWindow = FindWindow("FS98MAIN", NULL);<br />
oldWndProc = (WNDPROC)SetWindowLong(hFSimWindow, GWL_WNDPROC, (LONG)FSimWindowProc);<br />
break;<br />
}<br />
return TRUE;<br />
}<br />
From what I understand, the DllMain function is the most problematic part, since .NET doesn't support DllMain??
Thank you in advance for your help!
Joost
|
|
|
|
|
Correct. I don't believe you can write a non COM dll that plays with unmanaged code in C#. Why do you need to convert this code ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Well, I've heard this is the way to write FS modules that will be initialized automatically when FS starts. But I guess it's not possible then? I thought it would maybe be possible with MC++ in .NET 2.0, since it supports a mix up of old C++ code and MC++ code in one project (great feature BTW!). But I don't have a lot of experience with C nor C++ so I really have a clue if I'm right.
Well, maybe it's time to buy a good old C learning book then
Joost Huizinga
|
|
|
|
|
Joost Huizinga wrote: I thought it would maybe be possible with MC++ in .NET 2.0, since it supports a mix up of old C++ code and MC++ code in one project
Yeah, that should work. There's no reason I can see why you couldn't write a plain old dll in MC++. Not C# though.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
does it work with all webservers or only IIS ?
I use both VC# express and Borland C# builder and
VC# is using disco while C# builder uses uddi,
but both produce very look alike References.cs
also is it possible to query a website on available webservises
outside of IDE, like from executable, post disco and get back
wsdl.
explanations, references or links would be greatly appriciated.
TIA
|
|
|
|
|
if ILease.Renew will renew the lease why
would one ever use ISponsor for the same purpose ?
|
|
|
|
|
Hi ppl,
I tried to call COM+ services on other machines by using my local .NET framework. I set up the COM+ components on the other machine for server application usage. Further I want to use C# to call the services.
Does anybody have an idea how I can realize this scenario? I heard I should use DCOM but can't find information about using DCOM in the above scenario...
Thanks for your help,
Olmo
|
|
|
|
|
|
Hi Everybody,
We can convert our image's format to ten (.Bmp .Emf .Exif .Gif .Icon .Jpeg .MemoryBmp .Png .Tiff .Wmf) different image formats using System.Drawing.Imaging in C# via .net Framework 1.1
But, i also want to convert my image to other image fotmats as TGA,SVG etc. in C# too.
So how can i do this?
Is there any method or advice for me?
Please help me..
Thanks for your advices....
|
|
|
|
|
idris cinn wrote: SVG
svg is not an image format at all. It's a vector format.
You need to write your own code for these conversions. You also need to stop the annoying strong/bold tags in your posts.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|