|
Handle the OnTextChanged event of your textboxes to save wath field was changed and build the update string based on this data.
|
|
|
|
|
Better yet, don't do updates; do versioning instead. Updates are code smell.
And definitely use a parameterized query as Richard demonstrates.
|
|
|
|
|
Why do you care which field was changed, presumably you populate the control with the existing data and therefore you are just writing back the same information. Save the entire record!
Implement and audit system that records the before and after of each field.
And fix the sql injection exposure highlighted by Richard!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello
I want to find a way to control video files in my C# application. I want to open video files of various formats and then control them in frame level, going forward\backward few frames, jumping to an specific frame and things related. Thus far I haven't been able to find anything useful. Also I don't want any additional components being shown in my application (like the Windows Media Player COM). Also video scaling is needed.
Thanks in advance
|
|
|
|
|
Look at ffmpeg[^], OpenCV[^] etc. Not sure if there is a C# port available. But it won't be hard to call these libraries from C#.
|
|
|
|
|
http://www.c-sharpcorner.com/uploadfile/mgold/playingvideo11242005002218am/playingvideo.aspx?articleid=3d1c3b81-1a12-48e7-ad5e-758f96525409
i think this one is useful for you just refer it
|
|
|
|
|
Hi Team, i have aspx page with code behind in c#,the page has checkbox list which gets pulled dynamically(not static checkbox list), now my concern is once i do the check/uncheck of checkboxes and if i left mouse button then callback is happening which is not required i have verified the code base and there is no activation of callback event from code, check box unselect/selection is fine but if you click left mouse button on any part of the aspx page callback is happening which i dont want to happen.
i do not want to raise callback event if i do mouse click on the form, i tried different options to prevent but could not succeed, can some one guide on this
Thanks
msr
|
|
|
|
|
|
are you put postback property "true" for that control? I am not getting how these been made
|
|
|
|
|
I have a C# 2010 desktop application where I have code setup to see if a user is a member of an active directory group. I am using WindowsIdentity to check the current users active directory group level. The following code is not working. Thus can you tell me how to what is wrong with the code below?
If you think the code listed below will not work, can you tell me how you would modify the code listed below?
If you do no see anything wrong, can you tell me what to suggest to the network people at my company to suggest to them what is wrong?
using ActiveDirectoryCommon;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Collections.Specialized;
using System.Deployment.Application;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.Remoting;
using System.IO;
using System.Web;
using System.Configuration;
ConfigurationManager.Appsettings in the app.config file
using System.Security.Principal;
using System.Threading;
namespace File_Reject
{
static class Program
{
internal static ActiveDirectoryUser CurUser;
[STAThread]
static void Main()
{
try
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
CurUser = new ActiveDirectoryUser();
if
(!Thread.CurrentPrincipal.IsInRole(Environment.UserDomainName + "\\" + ConfigurationManager.AppSettings["role_File_Upload"]))
{
MessageBox.Show("You do not have authortity to access File Transfer. Please contact your network administrator if you have any
questions.", "File Transfer Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
Application.Run(new FileReject());
}
catch (Exception e)
{
}
}
}
}
----------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Reflection;
using System.IO;
using System.Threading;
using System.Web;
using System.Windows.Forms;
using System.Security.Principal;
namespace ActiveDirectoryCommon
{
public class ActiveDirectoryUser
{
public ActiveDirectoryUser()
{
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
Thread.CurrentPrincipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
}
}
}
-----------
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="role_File_Upload" value="File_Upload" />
</appSettings>
</configuration>
------------
|
|
|
|
|
dcof wrote: The following code is not working. You will need to provide more information than that. Try using your debugger to get some information about exactly what is happening, including any error messages.
Use the best guess
|
|
|
|
|
There is no error generated except what is in the code I listed above. When I try a differnet active directory group that I have access to, the code works. Thus do you think this is a network setup problem or my problem? How would you suggest the problem get fixed?
|
|
|
|
|
dcof wrote: How would you suggest the problem get fixed? Since the only information you have provided is that the code is not working, it's impossible to make any suggestions. The normal procedure would be to do some debugging to find out why the code is not working, and what failures are occurring.
Use the best guess
|
|
|
|
|
Check the length of your group names and such. I can't remember exactly but I encountered a limit of something like 32 characters. My code kept failing on my testing group. Finally tried another 'shorter' group and it worked.
IsInRole was the offending function for me. I never found anything online that said there was a limit.
Just a thought.
|
|
|
|
|
I pasre a Csv file,one Line is:
aaaa,,,"cc"",dd""e",,,,," ",,"nm,nnm",,," ",,,,,,," ",,,," ",,," ",,,,,"","a","bb
The Regex Pattern is:
string Pattern = "((?<=^|,)(?<field>)(?=,|$)|(?<field>[^\",\\r\\n]+)|\"(?<field>([^\"]|\"\")*)\")(,|\"(?<rowbreak>\\r\\n|\\n|$))";
But the result of last string "bb is wrong,the result is bb.How to modify it.
and Do you have any other ways to parse a csv file with RegularExpression
|
|
|
|
|
Why use a regex, when a simple string.Split() method call will do the work for you?
Use the best guess
|
|
|
|
|
Because it tends to get it wrong if the CSV data contains strings:
"hello", "hello, again", "goodbye" Is only three elements, but a Split won't spot that.
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
|
Good point, but not too difficult to write a parser that can handle such situations.
Use the best guess
|
|
|
|
|
Nope, but there are quite a few already written - and I wouldn't want to do it in a regex!
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
|
To be honest, I would be reluctant to use a Regex for CSV processing as it all gets a bit complex when you can have double quotes inside double quotes, and comma inside them as well.
I would use a CSV file processor myself: A Fast CSV Reader[^] is pretty good!
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
|
|
Yes - include a reference to the assembly in your project, then follow the "Using the Code" section of the article.
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
|
This one is not as comprehensive as the Fast CSV but it is simpler! CSV to Table to CSV [^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
WinForms, C#, .NET 4.5, VS 2012 v.3
I am successfully using a BinaryFormatter to serialize, and de-serialize, instances of a moderately complex class.
There is a reason, related to using a 3rd. party control, I need to get the in-memory serialized stream into a string, and, later, convert it from string format back to MemoryStream. At least that's a working strategy right now ... which may be tossed out.
What I don't want to do is write temporary files on the fly. My first experiments were with using XmlReader, and XmlWriter, and I could not figure out how to use, and then re-use, a temporary file written to disk in a loop.
As you probably know, an in-memory binary-formatted stream is essentially "readable" as a Byte[].
My experiments with using the Linq Cast<string>(), Convert.ToString() ... and so forth, have all been wastes of time (should have known better).
I'd appreciate any ideas you may have. Perhaps I have missed out on finding a way to write XML to an in-memory stream ? Temporarily blinded by too much experimentation ?
thanks, Bill
“Human beings do not live in the objective world alone, nor alone in the world of social activity as ordinarily understood, but are very much at the mercy of the particular language which has become the medium of expression for their society. It is quite an illusion to imagine that one adjusts to reality essentially without the use of language and that language is merely an incidental means of solving specific problems of communication or reflection." Edward Sapir, 1929
|
|
|
|
|
You probably want to use Encoding.GetString[^] - exactly which one will depend on what is in the stream:
byte[] bytes = myStream.GetBuffer()
string s = System.Text.Encoding.ASCII.GetString(bytes);
Or
byte[] bytes = myStream.GetBuffer()
string s = System.Text.Encoding.Unicode.GetString(bytes); Or one of the UTF properties - it depends on what is in the byte data. If it is truly byte then you may have to play to find a version that doesn't lose information when it is converted back!
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
|