|
I did understand. One of the links on that page leads to another which details how to get a collection of the changed rows (using HasChanges and GetChanges ). The changed rows have I think four versions, original, current, proposed and default (look up DataRowVersion ) Once you have the changed rows, you have all the information that you need to form an Update Query for the audit table ExecuteNonQuery[^]. If at all possible you should use parameterized queries.
Note that you must do this before applying the Update(), or GetChanges returns an empty dataset.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Yea i saw it. Thank you very much for the help and your time.
|
|
|
|
|
Hi Everyone,
I have a small application that I am developing that takes a half minute or so to load up (lot of stuff going on). I am wondering what the best way to display a "Loading" form is. For example, if you've ever used Adobe Photoshop, when you launch the program, a dialog/form shows up center screen and it tells you that its loading textures, fonts, etc. I want to do the same thing in my application.
Is the proper way to do this actually creating another form, showing that form in the main form onload event, and then destroying it after the loading process is complete?
Thanks!!
|
|
|
|
|
The normal way is to use another form with FormBorderStyle set to None and ShowInTaskbar set to false, and use a BackgroundWorker to do the initialization on a background thread, reporting progress back to this form so it can give feedback via a ProgressBar or whatever.
Search for SplashScreen C# and you'll find many examples.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
I am using Named Pipes to transfer data from a client (C++) to a server (C#), the client does the following:
[Code]
struct MESSAGE
{
char cCommand[8];
string sParameter;
};
MESSAGE msg;
strcpy(msg.cCommand, "COMMAND");
strcpy(msg.sParameter, "DO SOMETHING");
DWORD dwWrote = 0;
WriteFile (hpipe, &msg, sizeof(msg), dwWrote, NULL);
[/Code]
Then, at the receiving end the C# server does the following:
[Code]
IntPtr chRequest;
bool fSuccess = ReadFile(hPipeInst, chRequest, uSize, cbRead, OverlappedPtr);
if (fSuccess)
byte[] temp = Encoding.ASCII.GetBytes(Marshal.PtrToStringAnsi(chRequest));
[/Code]
Now, at the receiving end, I need to transform the temp (byte[]) back into the STRUCT or something equivalent so I can access the members cCommand and sPatameter - but at this point I have no clue how to proceed... In reality doesn't need to be a struct, I just need to extract the data itself.
Note - the STRUCT MESSAGE is something I came up with, meaning that it can be changed if a different format would be helpful in the reconstruction (add the length of sParameter for example?), I just need a COMMAND and PARAMETER to be transfered in a single block (if possible).
Requirements are simple:
- COMMAND is a fixed-length 8-characters long string that indicates what action needs to be performed
- PARAMETER is a variable-length (unless this causes issues) parameter dependant on each COMMAND
For example:
COMMAND = TRANS
PARAMETER = C:\FILE.txt C:\NewFolder\FILE.TXT
(this is just to illustrate, there are a lot more applications)
If possible I would like to extract it as a chunk of data (byte[]) and then pass it along to my application where it could be decomposed, not a fan of reading in the size, then a field, then a size, then a field - that requires that my Communication be overly linked with my implementation.
If there is a more suitable way to implement this transfer please let me know... advice would be welcome...
Any help would be much appreciated.
Thanks,
|
|
|
|
|
that means, the first 8 bytes is the char[] and the other is the string.
|
|
|
|
|
I think the easiest way to do this is to replicate the struct on the C# end so you can pass the data using ref or out (or if it's a pointer that you get - Marshal.PtrToStructure) without needing to use the byte array.
You will have problems using both char[] and string when using C# as they are not the same as in C++.
char[] is really an array of bytes. The string may need to have a MAXSIZE constant. So, you may need something like this:
public static class Constants
{
public const int MAXPARAMETERENGTH = 1024;
public const int SIZEOFCOMMAND = 8;
}
[StructLayout(LayoutKind.Sequential)]
public struct MESSAGE
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.SIZEOFCOMMAND, ArraySubType = UnmanagedType.U1)]
public byte[] cCommand;
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = Constants.MAXPARAMETERENGTH)]
public string sParameter;
} I'm not happy with passing the command as a byte array - I've never had to deal with a char[] like this before.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hi,
Compilation in Release mode failed, where as it is successful in Debug mode.
few errors are listed below.
1. Error: The type or namespace name 'AxOfficeCtrl' could not be found (are you missing a using directive or an assembly reference?
2. Error: The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
Thanks in advance.
|
|
|
|
|
You should copy non GAC assemblies which are you are using to the bin\Release from bin\Debug directory of your project.
Life is a stage and we are all actors!
|
|
|
|
|
I am writing a multithreaded application. A download manager to be precise. When downloading one file, everything is quite fine. The thread starts, downloads the file and terminates as expected. When i start another download thread, however, when the first is still running, i get the error above 9in the subject). The problem is on this line of code which is meant to create a new filestream and write the retrieved data to the stream.
strLocal = new FileStream(Application.StartupPath+"\\"+SaveAsTextBox.Text,FileMode.Create, FileAccess.Write,FileShare.ReadWrite);
The download method is called Download(), is void and does not take any arguments.
A thread is started using
DownloadThread[j] = new Thread(new ThreadStart(Download));<br />
DownloadThread[j].Start();<br />
where j has a value incremented per click, so as to start a new thread each time.
What i do not understand is that the exception seems to suggest that 2 write operations are requesting to be handled by the same stream, yet it is actually a different stream because the user changes the SaveAsTextBox.Text on every new download.
Any answers?
BHM
|
|
|
|
|
At a guess it is trying to use the same stream (i.e. strLocal) it is a different file but that does not mean there is more than one stream.
That depends on where strLocal is declared and how the code that declares it is called. And that we don't know since it's not in your post.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
|
ankitjain1110 wrote: can anyone give me the code plz
No.
But if you research the SELECT Statement (SQL) you will find plenty of examples of extracting specific information, and if your research the DataGridView or DataGrid , depending on the version of VS and whether it is a Web or Windows Forms Application, you will find lots of examples for that part.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
A little advise on the type of questions you are asking:
1) Please check the spelling of the message before you submit to the world. Broken language is particularly very disgusting and irritating.
2) I believe you have a good, comfortable QWERTY keyboard and are not constrained to work from a mobile keypad or a like device. Hence avoid Text Speak for normal queries.
3) Discussion forums are intended to support your earnest endeavor and honest initiatives towards the task on hand by assisting you to elegantly confront and tackle any problems that thwart you from reaching the desired goal. Misusing/Abusing the forum as a substitute for homework is not going to help you go any farther.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
|
Start writing code for you by yourself and when you stuck in specific problem then post here,someone will hand you.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
sorry for asking directly the code. but have triead a lot. like i was just selecting the datagrid view.then after adding the datasource i tried the edit column and add column part...but am lost...no values is being displayed.i can do the codin till extracting the values into a datareader..what to do after that.
|
|
|
|
|
Hi,
How to create FTP site using "System.DirectoryServices" in C#? I want to set all the properties like IP,PORT , log directories , etc..
How can we create and set properties using "System.DirectoryServices" ? I would highly appreciate your help.
Thanks,
Mike.
|
|
|
|
|
|
hi,
I'm sorry to ask this, is creating a virtual directory same as creating ftp site on IIS server? I mean I want to programitically add properties like, ip address, port, logging format, etc.. how this can be accomplished?
Thanks,
Mike
|
|
|
|
|
Hi
I'm creating a WPF application, but I also integrated crystal reports into my application. The problem is, the form that the reports are shown on uses a standard Windows Form. I want my reports to have the same look and feel as the rest of my application. Can I customize this standard Form e.g. change the standard border to a nicer border with rounded edges, change the color of the form, maybe making it transparent, etc. etc?
|
|
|
|
|
Trying to revamp the form as you describe is more hassle than it's worth.
I would suggest that you use a standard WPF window and host your winfrom content in a WindowsFormsHost[^].
Latest toy built for fun: Web Lens
Best feature: Full size images when using Google image search.
|
|
|
|
|
i have a datagridview with columns group,description,unit_price,amount....i want only the first three columns of the data grid view to be populated..the fourth column is filled using calculations.is it possible to bind this to datatable ???
|
|
|
|
|
you can achieve this scenario in the database itself...
Code:
create table test_tab (m1 numeric, m2 numeric, m3 numeric)
insert into test_tab values (1,2,3)
insert into test_tab values (4,6,8)
insert into test_tab values (5,7,9)
select m1,m2,m3 , (m1+m2+m3) as tot from test_tab
<pre>
<div class="ForumSig">Padmanabhan
My Articles:
<a href="http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=5686247">Articles</a>[<a href="http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=5686247" target="_blank" title="New Window">^</a>]
My latest Article:
<a href="http://www.codeproject.com/KB/office/Word_Automation_Part1.aspx">Word Automation</a>[<a href="http://www.codeproject.com/KB/office/Word_Automation_Part1.aspx" target="_blank" title="New Window">^</a>]</div>
|
|
|
|
|
How to bind two data tables which are in the same dataset to a datagrid????Below is tha code i've written so far
OleDbDataAdapter da_pay = new OleDbDataAdapter();
DataSet ds_pay = new DataSet();
OleDbCommand pay_cmd = new OleDbCommand("select Group from group_details where [Group]='"+descriptiondpdwnlist .SelectedItem .Value +"'",con2);
da_pay.SelectCommand = pay_cmd;
da_pay.Fill(ds_pay,"bill_group");
DataTable pay_dt=ds_pay .Tables ["bill_group"];
OleDbCommand pay_cmd1 = new OleDbCommand("select Description from description_details where [Description]='"+descrptndpdnlt .SelectedItem .Text +"'",con2);
da_pay.SelectCommand = pay_cmd1;
da_pay.Fill(ds_pay ,"Bill_description");
DataTable pay_dt1=ds_pay .Tables ["Bill_description"];
con2.Close();
|
|
|
|
|