|
foreach ( dsLogPro.CompaniesRow row_Raw in ds_Raw.Companies.Rows )
{
dsLogPro.CompaniesRow found_Local = ds_Local.Companies.FindByCompanyCode( row_Raw.CompanyCode );
if ( found_Local != null )
{
if ( !found_Local.Equals( row_Raw ) )
{ // raw will trump local
foreach ( DataColumn col in ds_Local.Companies.Columns )
{
found_Local[ col ] = row_Raw[ col ]; // update local with raw
}
}
}
else
{ // this must be a new row
found_Local = ds_Local.Companies.NewCompaniesRow();
foreach ( DataColumn col in ds_Local.Companies.Columns )
{
found_Local[ col ] = row_Raw[ col ]; // update local with raw
}
ds_Local.Companies.Rows.Add( found_Local );
}
}
This is the direction I'm currently moving towards. I don't believe the tables will change but the columns might change in the future so I'm really trying to keep this flexable.
I'm listening but I only speak GEEK.
|
|
|
|
|
private void CompaniesCompare()
{
rowsAdded = 0;
rowsDeleted = 0;
rowsUpdated = 0;
start = DateTime.Now;
// This will update and add the rows
m_parentProcess.OnPostMessageEventHandler( this, new MigrationEventArgs( "\tcomparing company data." ) );
foreach ( dsLogPro.CompaniesRow row_Raw in ds_Raw.Companies.Rows )
{
dsLogPro.CompaniesRow found_Local = ds_Local.Companies.FindByCompanyCode( row_Raw.CompanyCode );
if ( found_Local != null )
{
if ( !found_Local.Equals( row_Raw ) )
{ // raw will trump local
foreach ( DataColumn col in ds_Local.Companies.Columns )
{
found_Local[ col ] = row_Raw[ col ]; // update local with raw
}
rowsUpdated++;
}
}
else
{ // this must be a new row
found_Local = ds_Local.Companies.NewCompaniesRow();
foreach ( DataColumn col in ds_Local.Companies.Columns )
{
found_Local[ col ] = row_Raw[ col ]; // update local with raw
}
ds_Local.Companies.Rows.Add( found_Local );
rowsAdded++;
}
UpdateProgressBar();
}
// This will remove un-needed rows
foreach ( dsLogPro.CompaniesRow row_Local in ds_Local.Companies.Rows )
{
dsLogPro_Live.CompaniesRow found_Raw = ds_Raw.Companies.FindByCompanyCode( row_Local.CompanyCode );
if ( found_Raw == null )
{ // was not present in the raw so remove it.
ds_Local.Companies.Rows.Remove( row_Local );
rowsDeleted++;
}
UpdateProgressBar();
}
}
This is what I have ended up with and would like someone elses opinion on the code.
I'm listening but I only speak GEEK.
|
|
|
|
|
I'm trying to fill in a text box then hit the submit button using httpwebrequest.
Here is a sample using googles home page. I just cant seem to get it to work. Thanks for the help.
string Uri = "http://www.google.com";
string requestString = "q=test&btnG=Clicked";
byte[] requestData = Encoding.UTF8.GetBytes(requestString);
HttpWebRequest request = null;
Stream stream = null;
HttpWebResponse response = null;
// set up request
CookieContainer _cookies = new CookieContainer();
request = (HttpWebRequest)WebRequest.Create(Uri);
request.Proxy = null;
request.CookieContainer = _cookies;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = requestData.Length;
// make form post
stream = request.GetRequestStream();
stream.Write(requestData, 0, requestData.Length);
// get response
response = (HttpWebResponse)request.GetResponse();
|
|
|
|
|
You may find this[^] article useful.
/ravi
|
|
|
|
|
See Here. It shows how you can fire button click event.
Be Good Have Good
|
|
|
|
|
I just want to join a couple of short wmv-files captured from a webcam.
I've googled for a while and I'm no wiser.
The only lead I found is wmvappend from windows media sdk samples, but it's VC++ and couldent even get it to build.
Any pointers?
|
|
|
|
|
Hello,
I would suggest you to please browse to the following link which gives more information on the same:
http://www.codeproject.com/KB/graphics/ConvertVideoFileFormats.aspx?print=true
Best Regards,
Sam Xavier
www.componentone.com
|
|
|
|
|
Thanks.
I'll take a look at it.
|
|
|
|
|
Hey ya'll,
I want to retrieve an image from a web page using the clipboard.
The question: I am trying to use the MemoryStream returned by GetData("DeviceIndependentBitmap") and create a bitmap for viewing from this.
I've googled and can't find squat so am asking the pros...I'm currently trying to do it this way;
MemoryStream stream = (MemoryStream)data.GetData("DeviceIndependentBitmap");
Bitmap bmp = new Bitmap(stream);
and I get the following exception: "Parameter is not valid"
Thanks,
Mike
Life is not measured by the number of breaths we take, but by the
moments that take our breath away. "George Carlin"
|
|
|
|
|
Hi,
I got a code where I move the mouse around the screen... Everytime the mouse moves a pixel, i have an action.
In that action, i want to find the color of the pixel there are in the screen position: 395,247...
Just need the color in HEX (#xxxxxx) or RGB (xxx,xxx,xxx).
Can anyone make an example for me to do that?
Thanks.
|
|
|
|
|
|
Thanks works perfect..
|
|
|
|
|
You're welcome
Kristian Sixhoej
"Failure is not an option" - Gene Kranz
|
|
|
|
|
Hi.
I'm writing an application that it use a SQL table for store and read data.
Sometime, I need to list all the registers between two dates, (there is a field of type datetime in the table).
So, I have to objects of type DateTime, ie, d1 and d2. Can anyone help me with the query string to list the registers between these two dates??.
Table name: Table1
Field datetime: birth
Query: "Select * from Table1 where birth > " + d1.toString() + " And birth <= " + d2.toString(); // It doesn't work.
I also tried with "#" characters between DateTime objects, but it doesn't work anyway.
Thanks.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
You should not use string concatenation since it opens you up to sql injection attacks. Use parameterized queries instead.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Paul Conrad wrote: You should not use string concatenation since it opens you up to sql injection attacks.
Hi there Paul,
Please explain your statement.
Thanks in advance.
Danny
|
|
|
|
|
|
Thanks man.
Good info.
Danny
|
|
|
|
|
I'm not sure if this will work - give it a go anwyay:
<br />
"Select * from Table1 where birth > cast(""" + d1.toString() + """as datetime) And birth <= cast(""" + d2.toString()+""" as datetime)"<br />
Regards
Guy
You always pass failure on the way to success.
|
|
|
|
|
Hy there,I hava a problem..I created a control that has a public Brush property that the developer chooses from the property window. But If i change it..it doesn't get serialized to InitializeComponent() so at runtime it still has the default value
I created a UIEditor for this property and a BrushConverter : TypeConverter to let the design-time know how to convert from a InstanceDescriptor to a Brush.
Why doesn't this work? I debugged the design-time and when I change the property..the breakpoint in the method ConvertTo from the type converter doesn't hit
Thank you in advance.
|
|
|
|
|
Hi All,
In C++ i used the method "SetWindowsHookEx" to set this hook.
Is there is some easy way in .NET to do it ?
Thanks.
|
|
|
|
|
Well, the easiest way, would probably be to use SetWindowsHookEx!
using System.Runtime.InteropServices;
...
public enum HookType : int
{
WH_JOURNALRECORD = 0,
WH_JOURNALPLAYBACK = 1,
WH_KEYBOARD = 2,
WH_GETMESSAGE = 3,
WH_CALLWNDPROC = 4,
WH_CBT = 5,
WH_SYSMSGFILTER = 6,
WH_MOUSE = 7,
WH_HARDWARE = 8,
WH_DEBUG = 9,
WH_SHELL = 10,
WH_FOREGROUNDIDLE = 11,
WH_CALLWNDPROCRET = 12,
WH_KEYBOARD_LL = 13,
WH_MOUSE_LL = 14
}
delegate int HookProc(int code, IntPtr wParam, IntPtr lParam);
ImprortDll["user32"]
public static extern IntPtr SetWindowsHookEx(HookType idHook, HookProc lpfn, IntPtr hMod, uint dwThreadId);
Check out: http://www.pinvoke.net/default.aspx/user32/SetWindowsHookEx.html[^] for more info.
My current favourite word is: Bauble!
-SK Genius
|
|
|
|
|
Did you search codeproject? There are many articles here describing how to do it
|
|
|
|
|
hi
am doing a project in getting the emails from a server through local network and i've done most of the code but my problem when i get the mails from the server to display, all emails in the server display so my Qusetion is which command should i write that i can display only the last email i've recived??
|
|
|
|
|
Well, if you're displaying them, what's hard about showing only the last one ?
'
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|