|
Thanx for your help Heath. Much appreciated.
If there's one thing I've learned, it's that life is one crushing defeat after another until you just wish Flanders was dead. - Homer Simpson
|
|
|
|
|
hi all,
I want to trasfer data from access to SQL. I am doing this in .Net ,using C#.I did it like this:-
this.oleDbDataAdapter1.Fill(this.dataSet11,"AthleteArchive");
this.sqlDataAdapter1.Update(this.dataSet11,"AthleteArchive");
BUT this is not working...
"AthleteArchive" --is a table of the Access Database..oleDbDataAdapter1,sqlDataAdapter1 & dataSet11 are created using Wizards.(Drag & Drop the Relevent Table to the Design view)
Can u please tell me, what is the Problem in there and How do I correct this?
thanks...
|
|
|
|
|
First of all, SQL Server already includes DTS (Data Transformation Services) that is better for this job, and it even provides programmatic (through COM, which you can interop for use with .NET) access to DTS transforms. This is the preferred way of doing it, and you can read much more about it in the Books Online documentation for SQL Server that should be installed as well.
You need to look at the SqlDataAdapter.TableMappings collection property documentation, as well as related documentation (follow the links), in the .NET Framework SDK. This dictates how to map result sets to table names in a DataSet , and you have to add the named DataTable to the DataSet . Be sure to read about typed DataSet s in the ADO.NET portion of the .NET Framework SDK. If you create a typed DataSet in VS.NET, this will make things much easier (right-click on your project, select Add->Add New Item->DataSet and design it using elements (tables) and child elements (fields)).
You should also read the documentation for DataAdapter.Fill and Update . Unless you want ot copy data table-by-table, you should just use the single parameter overload which takes a DataSet . Assuming your DataSet has the right structure (tables and fields) and - if applicable - relationships, data will be copied correctly (so long as any foreign key constraints or data constraints in the DataSet aren't violated).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have an application that generates an archive of log in the following format (log.txt): dd/mm/yy hh:mm:ss [ name of the user ] [ description ].
I need that when the application will be initiated it it verifies this register that removes the register dated in d-3.
Regards
Flavio Serrazes
|
|
|
|
|
Flavio Serrazes wrote:
I have an application that generates an archive of log in the following format (log.txt): dd/mm/yy hh:mm:ss [ name of the user ] [ description ].
I need that when the application will be initiated it it verifies this register that removes the register dated in d-3.
This makes no sense what-so-ever. What register? What's "d-3"? And what does it have to do with a log file?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi All..
I have some code in c++ and change to c# as below:
<br />
uint dImageSize;<br />
byte pImage;<br />
byte pImagePtr;<br />
<br />
<br />
pImage = (byte)malloc(dImageSize);<br />
<br />
<br />
free(m_pImage);<br />
Any one could help me? Thank you.
hello ALL..^^
|
|
|
|
|
Rulala wrote:
pImage = (byte)malloc(dImageSize);
This is C, do you know why C++ was not used ?
malloc and free are used to allocate memory in C, in C++, new and delete are used. In C#, delete is not required, and the code would look like this:
using System.Drawing;
Image image = new Image();
That's it. Image.FromFile could be used instead to create an image in memory from a file.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Hi Christian , Thank you for your instruction.
About Image image = new Image();
If I need to define fixed size of memory(dImageSize).
How do I need to do?
Thank again.^^
Hello All , I'm rulala.
|
|
|
|
|
You don't need to delete it, but since Image implements IDisposable (and for good reason), you should call Dispose on the Image instance after you're done with it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Heath , Thank you for your reply .
I'm sorry that I didn't have detailed description.
How do I provide fixed size of buffer(memory) for code to use?
If I create Image() , Can I control memory size to Image?
Thank again.
hello ALL..^^
|
|
|
|
|
.NET is called a "managed environment" because the CLR manages the memory - you should not. The .NET Framework class library is there to encapsulate all this for you, and you should never assume a certain number of bytes for an image since different pixel formats and options can change that. If you want, you can P/Invoke unmanaged APIs and go back to managing all the memory yourself, but then what's the point of using a managed language like C# to target the CLR or another CLI implementation like Mono?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank you very much .
You provide very good instruction.
Thank you...^^
hello ALL..^^
|
|
|
|
|
I have a class that I inherited from the DataGridTextBoxColumn class. There is a button that is in the textbox of this column, similar to a combobox button (only it has different functionality than the combobox). Anyways, first thing in the override Edit function, I am positioning the button so that it is on the right hand side of the TextBox.
The code seems simple enough...
myButton.SetBounds( this.TextBox.Width - this.TextBox.Height, 0, this.TextBox.Height, this.TextBox.Height );
Something is crazy about this though. This code works perfectly when the application runs under the .NET Framework 1.0.3705, and the button is always positioned exactly as desired. However, when the application runs under the .NET Framework 1.1, the button REFUSES to go where it is supposed to! What's the discrepancy between these versions, and what in the world am I doing wrong?
This isn't the only place I'm noticing a difference in the behavior of my program, but it seems like no matter what I do, I can't seem to prevent these effects from occurring. Need Help!
Thanks a ton!
|
|
|
|
|
Has anyone put a Chart from MSGraph onto a WinForm using C#? I have total programatic control of the Graph.Chart object in PowerPoint using C# through a COM AddIn but... I can't seem to figure out how to make it a control for a WinForm. aximp tool doesn't work because it expects an ActiveX control. Is there an OCX for Graph?
Thank you for any help you can provide.
Mark Finley
|
|
|
|
|
hi,
This may because of improper usage of commandline aximp .Try to add using add/remove component menu which is avilable once you right click the toolbox window. And choose Com compoenent
Microsoft Control 6.0 ( c:\windows\system32\mschrt20.ocx file.
If it doesn't serve your purpose please let me know that.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
I have an application that I am deploying using a C# Setup and Deployment application. The project includes a number of different executables and other support and configuration files. What is happening is that if a file that was "laid down" by the install application is moved or deleted, a repair install is initiated when I access any of the shortcuts in the programs menu. The nature of my application requires that some of the installed files be moved to other locations on disk by the user after the install, but when we move the file a repair install is initiated. Is there a way to disable this option. I do not want the repair install to kick in if installed files have been moved.
|
|
|
|
|
The shortcuts are not normal shortcuts. They invoke the application through the MSI runtime, which first checks to make sure that components are where they should be.
You have several options: 1) don't use the Setup and Deployment project, 2) use a professional Windows Installer development environment like Wise for Windows Installer[^], or 3) hack the MSI package (using Orca, for example, which can be downloaded with the Platform SDK[^]). You can include a normal shortcut that is just like creating one manually on the desktop. This will not prompt the MSI runtime to check for the components.
You can also set attributes on the components that allow them to move around (untracked, mind you), but the Setup and Delpyment project is a base-bones, everything-done-for-you project not intended for serious use.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
trbo,
What is the situation that requires moving the files into different locations after install is complete? You have enough control building an MSI to control even dynamic folder locations as long as you have a standard referential point of those folders.
In my one deployment we are installing all of the remoting files and some model files into various directories. I created custom folders driven off of the [TARGETDIR] location. When the user changes TARGETDIR (install path screen) it automatically changes my custom folders as well.
Explain further, I may be able to help you.
This signature left intentionally blank
|
|
|
|
|
Thanks for the help. My Application lays base files and executables and a number of other working files that the user will use in seperate working folders. There are also files that need to copied\moved to server locations to interact with other server applications (I have no idea where these are installed and in most cases they are on different boxes to where my application is being installed.) I have specified that the user should only copy the files not cut them as this initiates the repair install. However in many cases they still cut them and many support calls are logged about this.
I have followed up on the Orca option and have this working. Thanks a million. It is actually very simple. Once you have Orca installed all you need to do is open the MSI file using Orca and add a new property to the Property Table. The property to add is DISABLEADVTSHORTCUTS with a value of 1.
|
|
|
|
|
I'm making some asynchronous calls using Delegate.BeginInvoke. I wanted to know the naughtiness of a fire-and-forget in this situation -- do I really need to call .EndInvoke? It seems Don Box and others say no, while I've read on some other .NET blogs cautions that the framework might leak resources without a .EndInvoke call.
Any thoughts on this?
Also, I would like to get some thoughts on the following code snippet...it appears that using the new anonymous methods in .NET 2 eases the use of .EndInvoke, for example
void OneNiceCleanFunction()
{
ThreadStart lengthyDelegate = delegate
{
DoLengthyFoo();
};
AsyncCallback callbackDelegate = delegate
{
FooAfterLengthy();
lengthyDelegate.EndInvoke();
};
lengthyDelegate.BeginInvoke(callbackDelegate);
}
Any thoughts on how well this code would perform/what overhead the compiler will generate for me? If the above code is acceptable, I imagine it will make the coding of .EndInvoke a lot easier without declaring a bunch of extra fields and methods in the class.
Judah Himango
|
|
|
|
|
|
That's a very good read. He suggests pretty strongly that we should always use EndInvoke... Oddly enough, if you look in the comments to that post, it turns out you don't need to call .EndInvoke on any Sys.Win.Forms.Control classes as it doesn't follow the BeginXXX/EndXXX model the same as delegates.
Judah Himango
|
|
|
|
|
You call EndInvoke when you want the return value of the method (if applicable), or simply to block until the method is done (perhaps you wanted to perform some additional operations while asynronously executing a particular method, but now you want to wait).
Use anonymous methods like that should not be taken lightly. There is a lot of code generated with an automatic naming convention that could change from compile to compile (depending on how your source is modified). Take a look at the article, Create Elegant Code with Anonymous Methods, Iterators, and Partial Classes[^], for more information on how anonymous methods are compiled to type metadata and IL instructions.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
What would be the best way to get a list of installed applications on a local PC? The program I'm working on is to run at startup, gather some PC info, and then insert it into a SSE table.
|
|
|
|
|
leifm wrote:
What would be the best way to get a list of installed applications on a local PC?
There are commercial applications that can provide this type of application so I am sure there are more ways than what I will suggest in this thread however I would first start by looking at the hive of HKEY_LOCAL_MACHINE\SOFTWARE in the registry as this will give you a list of applications installed.
- Nick Parker My Blog | My Articles
|
|
|
|