|
In addition to what Colin is saying, if you would have done it correctly in the first place (using parameterized queries), this would never have been a problem. The SQLParameter objects automatically inspect your parameters for characters that need escaping, such as the quotes, and make corrections as needed. They even scan that params for certain types of attacks.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
if u want sql ignore the single quotes write 2 single quotes :
Values('jon''thes','30')
Values('jon
'' thes','30')
Values('jon
'' thes','30')
To study, study and only to study
|
|
|
|
|
|
SqlCommand command = new SqlCommand("INSERT INTO test (name, age) Values(@Name, @Age);
command.Parameters.Add("@Name", "jon'thes");
command.Parameters.Add("@Age", "30");
Like Colin said, the change isn't reallly that difficult and it's one that needs to be made for security's sake.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: He has a funny face. And he's my son.
Judah Himango
|
|
|
|
|
Hallo,
I'm developing an application with lots of little .wav files. I'd like to distribuite this .wav files as a unic .dll, so the user can't view or midofy the .wav files. I clicked on myproject with the right mouse button and I selected "add existing item" and I searched for my wave file. Now the wave file is listed into the project (together re refernces, to forms, the ico etc...). The question is: how can I access to that wave??
Thanks
CometKeeper...
|
|
|
|
|
First change the property build action of the files to embedded resource.
Then you can access them via a stream:
<br />
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();<br />
System.IO.Stream inputStream = assembly.GetManifestResourceStream("[AssemblyNamespace].[FileName]");<br />
|
|
|
|
|
Ok, but I need one more clue if you please
Suppose: I have incluede wav1.wav, and my application is called - as standard - WindowsApplication1 so...
---
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
System.IO.Stream inputStream = assembly.GetManifestResourceStream("WindowsApplication1.wav1.wav");
---
The clue I need is... I'm using the PlaySound form winmm.dll How can pass the waveform to this function?? or in other words, How can play the sound if PlaySound can't be used - I'd like not to use DirectX.
Thnks
CometKeeper
|
|
|
|
|
Sorry but I cant help you with this. I never had the need to play any sounds in my apps
|
|
|
|
|
Hi all,
I have to develop a student project of live video streaming from one pocket PC to another. So i have to capture the video input from one pocket pc camera, and stream it to another pocket pc.
I would like to know whether it is possible to do it with .NET compact framework (C#) or no. My boss wants to use Visual C++ Embedded, but i think C# and .NET would be easier. Could you please give me any advice ?
Thank you
Manuela
|
|
|
|
|
Hi Folks,
I have a MDI Parent form which has its own MainMenu. At design time everything is fine, but at run time the Main Menu disappears.
After some testing, I found out that if the form's IsMDIContainer property is set to false, the Main Menu appears.
If I set IsMDIContainer = true just before loading any MDI Child, the menu shows, but it wont merge with the Child menu items, besides, the MDiList of the parent wont update.
I've even tried to create the Main menu in the Load event of the form, but its the same.
Any suggestion? I've ran out of ideas here
|
|
|
|
|
While I am not sure of the various properties set by you for the menu items of the MDI form and Child form, I may add that generally speaking, by default, MDI parent forms add MDI child menus automatically. Two properties, "MergeType" and "MergeOrder", determine how individual menu items are handled during a menu merge and the relative position of each MenuItem in the newly-merged menu. You can set these properties on MenuItems individually or collectively to determine the items' presence and location within a menu merge.
Also remember the use of the "MenuMerge" enumeration which has 4 members, namely, "Add", "MergeItems", "Replace" and "Remove". These members can create various combinations for the merged menus, and depending upon the selected option the merged menu may not show properly.
So, you may like to check the values of "MergeType" and "MergeOrder" properties of menu items on the MDI Form and Child forms. Try using the value of the "MergeType" property as "Add" instead of "Replace" or "Remove" if the latter values are set in your code. This can be done at design time as well.
If it does not help you, please try to give some more details of your problems.
|
|
|
|
|
Yes, I also played with that. I have 3 MDI child forms at the moment, one of them has NO menu at all, and the other two have 'MergeType' set to Add, each of them with the appropiate MergeOrder value, but the problem is the same, the Menu from the Main form keeps disappearing.
Anyway, after a couple of hours more trying to fix it, I decided to use the MenuBar provided in the user interface suite we generally use (Janus controls). I am reluctant to use them because these fancy UI controls are memory swallowers, but for this MDI problem they work, so to hell with VS MainMenus.
Thanks for the reply though, Dr Ashok.
|
|
|
|
|
please tell me how can i convert the image into bytes and how can i recieve it in the client and the vice versa and how can i convert it back into image in the server side.
with illustrative code if possible please
Miss With The Best And Die Like The Rest
|
|
|
|
|
Hello
You can try to use LockBits and access your image as byte array. Look at the previous my answer to you, there was a sample.
Andrew
|
|
|
|
|
Hello,
Do you know how to deploy a windows application with a ms access database,
Thanks for your help.
|
|
|
|
|
If you use a mdb file in your application, you can add it in the setup project and it will be included in the installer.
Besides, if the target machine does not have MS Access installed, you will need to include in your installer the Microsoft Data Access Components (MDAC), which can be freely distributed. You could install this components as a Custom Action in the setup project.
Hope it helped
|
|
|
|
|
Hello,
I want to resize the checkbox of the checkbox control.
I think, I should override the OnPaint event, but I do not know how.
Please help me.
Thank you.
|
|
|
|
|
If you want to resize the checkbox control itself (i.e., the rectangle including the text accompanying the checkbox), then you can use the "Size" property by indicating the new height and width of the control (or alternatively, you can directly change the values of the properties "Height" and "Width"). These changes can be made in the constructor of the Form on which the checkbox control is placed, after the InitializeComponent() has already been called.
However, if you are interested to change the size of the "checkbox" itself and not of the "control as a whole", perhaps the only method would be derive your own custom control with the appropriate size.
|
|
|
|
|
hi. i was wondering if anyone had encountered my problem before.
I have a print document and it works with the .print() method.
next i create a new printpreviewdialog and set its .document to the print document
what happens is that the printpreviewdialog shows an appropriate preview of the document, but when i click the print button it simple prints a blank page.
it is supposedly working before (i am extending a previous work)
can anyone tell me what the possible problems could be?
just an addition, for the printdialog, do i need to set anything for printer settings to work? (i.e. draft or best quality)
|
|
|
|
|
I have three question:
1.how do an abnormity form?
2.how display line-number in richtextbox control?
3.how display highlight color keywords in richtextbox control?
thanks!
|
|
|
|
|
1) I have no idea what you mean by an "abnormity form"...
2) A RichTextBox control is not a good candidate for this. There is no support for adding line numbers. You'll either have to come up with your own control or search the web for a control that does support this.
3) Look at the SelectionStart , SelectionLength , and SelectionColor properties.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi,
I meet a question in defeloping a addin project.
When I run the project with ide the first time ,I could find the icon of my addin in tool menu.
But when I run the project again in order to debug it, I couldn't find the icon, although I could find it in the addin project manager and I had set it enabled.
ps,I had download a sample of addin project from codeproject and change the code of it,then ,this question had never taken place in this project.
Had somebody met the seem question? and would somebody mind give me some advice.
You can send email to me .
my email is py1@263.net or buaa.pengyi@gmail.com.
thank you
|
|
|
|
|
could anybody help me? is this question too easy to answer or I haven't described it clearly enough
|
|
|
|
|
Hi
What I want to know is if the this.budget is a copy of the sent in object or if it just works as a ref?
/Regards Johan Hertz
<br />
public class Statment : System.Windows.Forms.TabPage<br />
{<br />
private XmlBudgetDocument budget;<br />
<br />
public Statment(ref XmlBudgetDocument budget)<br />
{<br />
ChartStatment c = new ChartStatment();<br />
this.budget = budget;<br />
Array bankaccounts = budget.GetAccountNodes();<br />
c.BuildBankaccount(bankaccounts);<br />
this.Controls.Add(c);<br />
}<br />
}<br />
|
|
|
|
|
It's hard to answer that question definitively without knowing if XmlBudgetDocument is a reference type (lives on the heap with only a memory reference in the stack/vtable) or if it's a value type (lives solely on the stack).
If XmlBudgetDocument is a reference type (like an ArrayList or most collection classes, for instance), then the 'budget' field will get a copy of the pointer to the original 'budget' parameter passed to the constructor, the two variables will point to the same object, and changes to one will be reflected by the other.
If XmlBudgetDocument is a value type (like a struct, or custom type), then the 'budget' field will get a distinct copy of the 'budget' parameter passed to the constructor - the copy will occupy its own stack space and changes to one will not affect the other.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|