|
So it's a console application, try this...
string aPath = Environment.GetCommandLineArgs()[0];
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Your spelling of Application is wrong
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
hi!
i want user can enter single cot(')in textbox.
i m using SQL yog but it display error as the insert query become
('dgfd dfg ddf_'','','',8) u can see here actually there are for paramerte but it shows error
|
|
|
|
|
Use Replace function from C# code.
Something like:
TextBox1.Text.Replace("'","''");
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.
|
|
|
|
|
Note: That is the correct way to escape a string for some specific databases, like MS SQL Server and MS Access. For other databases you need to do it differently.
It's important to use the correct escaping method for the specific database, otherwise the code is still wide open for SQL injections.
If you use a parameterised query instead, there is no need for escaping.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I agree with you.
I just didn't have enought time to explain more in my first reply of this question.
I appreciate your additional answer.
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.
|
|
|
|
|
Your application is wide open for SQL injection attacks.
Please instruct your users not to enter this in the text field:
','','',8);drop table Users;--
Alternatively, you can correct the code. Use parameterised queries instead of concatenating the data into the query.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
well the solution you should take, and not just to solve you issue but make it more secure, is to use parameters[^] with the sql queries
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hello, here is what i want to do:
I Have created ListView. I have added Some items.
Now i want to have ToolTip on those items. Not on Control, but every item woud have diffrent tooltip.
Thank you in advance
|
|
|
|
|
If you set the ShowItemToolTips property of the ListView control, then you can add a ListViewItem with has the ToolTip property set
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Dear Friends,
I want to execute below java script from code behind of C# .NET
string url="/AssetItems"+"/frm"+assetitem+".aspx";
str="<script type=text/javascript language=javascript>";
str=str+"parent.frames[main3].location.href = "+url;
str=str+"</script>";
Page.RegisterClientScriptBlock("Message1",str);
it gives me java script error as "syntax error"
two frames named as top and main3. In top frame I have some search criteria in which I need to do some C# coding and as per result I want to display a page in main3 frame.
Your quick help would be highly appreciated
Thanks and Regards
Murtuza Patel
|
|
|
|
|
I had a BHO appliaction (in-process dll injected in IE) which was developed in Vs2005 c#.
I had made an msi setup with the help of Setup and Deployment Project.
This was the installer class I had added in my project which generates the required dll...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using Microsoft.Win32;
using System.IO;
namespace BHOPDF
{
[RunInstaller(true)]
public partial class Installer1 : Installer
{
public Installer1()
{
InitializeComponent();
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Commit(System.Collections.IDictionary savedState)
{
base.Commit(savedState);
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
protected override void OnCommitting(System.Collections.IDictionary savedState)
{
string regasmPath = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() + @"regasm.exe";
string componentPath = typeof(Installer1).Assembly.Location;
System.Diagnostics.Process.Start(regasmPath, "/codebase \"" + componentPath + "\"");
base.OnCommitting(savedState);
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
protected override void OnAfterInstall(System.Collections.IDictionary savedState)
{
base.OnAfterInstall(savedState);
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
protected override void OnBeforeUninstall(System.Collections.IDictionary savedState)
{ string regasmPath = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() + @"regasm.exe";
string componentPath = typeof(Installer1).Assembly.Location;
System.Diagnostics.Process.Start(regasmPath, "/u \"" + componentPath + "\"");
base.OnBeforeUninstall(savedState);
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Uninstall(System.Collections.IDictionary savedState)
{
base.Uninstall(savedState);
}
}
}
The problem is after I uninstall my setup, and If I check the registry
"Software\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects"
my dll gets un-injected.
After uninstalling, and after sometime, If I check the registry again there my dll is visible as injected. How this is happened?
What was the mistake in the code, can anyone suggest something to solve this?
|
|
|
|
|
hi,
here's the layout:
- datagridview with 5 columns, last column is CheckBox Column.
the purpose :
- by pressing a button = deleting each row that has a marked CheckBox
the current algorithem :
if (dataGridView1.RowCount > 0)
{
for (int k = 0; k < dataGridView1.RowCount; k++)
{
if ((bool)dataGridView1.Rows[k].Cells[5].Value)
{
dataGridView1.Rows.RemoveAt(k);
}
}
}
the problem :
after the first deletion, the
"(bool)dataGridView1.Rows[k].Cells[5].Value"
throws this excption :
Object reference not set to an instance of an object.
anybody ???
THANKS
Have Fun
Never forget it
|
|
|
|
|
The problem is:
You count the rows. and pass as k, but the .rows[k] is zero based index, so you need to "Count -1"
Another method is:
foreach(DataGridViewRowsCollection dvrc in dataGridView1.Rows)
{
// To show how to contiune
// dvrc.cell[5]
}
|
|
|
|
|
1.
for (int k = 0; k < dataGridView1.RowCount; k++)
is'nt tha problem becase :
k < dataGridView1.RowCount
if i have 7 rows it'll start at 0 and at 6 becase 7<7 is false
2.
i've tried to change it to foreach, but still the same problem
3. thanks
Have Fun
Never forget it
|
|
|
|
|
Do it in reverse
dataGridView1.RowCount: i=0; i--
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
I got what the problem is:
example:
[0] Item 1
[1] Item 2
[2] Item 3
If [1] and [2] are checked:
After first delition:
[0] Item 1
[] Deleted Item2
[1] Item 3
In other words, when you delete items you have less items in Datagrid view. make another count within For and make sure it count++ when you delete items. and you do like [k-count]. at first count is 0, and more items you delete, higher count woud get and correct problem
|
|
|
|
|
first of all,
thanks for responding,
i've did managed to figure it out
thanks anyway
and have a cool week
Have Fun
Never forget it
|
|
|
|
|
Anyone can advice how to implement functions like the ones in the Character map utility to a font dialogue?
Im asked to develop the code page, the character "mapping" and in a font dialogue for extended function.
The problem i have is:
1. how to load the unicode or unicode subrange from the comp. i have no problem with loading the font.
2. how to create the data grid to show all the character with the effect of the font style and font type, just like the ones in the character map utility.
Thx in advance.
|
|
|
|
|
You can develop your own CharacterMapDialog. In which have you can use the character to implement and use it in your application.
1. You can convert the Ascii character to unicode by using ToUnicode Function.
2. Set All Controls Font style to according to selected font.
If you can think then I Can.
|
|
|
|
|
I was trying to disable back button of IE window in the following way but
the back button on top left corner of IE is not disabled.
document = (HTMLDocument)webBrowser.Document;
string javaScriptcode = "javascript:window.history.forward(1);";
IHTMLWindow2 parentWindow = document.parentWindow;
parentWindow.execScript(javaScriptcode, "javascript");
How can I do this
|
|
|
|
|
If you have a webbrowser control, you can just hide the back button. You can't stop a right click and back tho. Instead, you should fix your overall design.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
hi,
I want to ask how to get size of struct that I made?
ex:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct MT_EVENT
{
public Int64 TimeStamp; // In FILETIME format
//public LARGE_INTEGER TimeStamp; // In FILETIME format
public uint UserStatus; // Not used by API
public uint EventCode; // Event Code
public uint SubReason; // Event sub-reason
public uint XtraInfo; // Extra information, e.g. termination
public uint FuncCode; // Function active when this event occurred
public uint Board; // Board ID
public uint Channel; // Global Channel ID (GCI)
public IntPtr ptrBuffer; // Related play/record buffer pointer
public uint DataLength; // Byte length of data accessed (played/recorded)
public IntPtr ptrXtraBuffer; // Pointer to xtra buffer
public uint XtraBufferLength; // Length of buffer pointed by ptrXtraBuffer
public uint XtraDataLength; // Length of data in buffer pointed by ptrXtraBuffer
public uint EventFlag; // Falgs of the following:
// bit 0x00000001: 1 - Appl created the event
// 0 - NTi DLL created the event
// bit 0x00000002: 1 - Appl allocated ptrtraBuffer
// 0 - NTi DLL allocated ptrXtraBuffer
}
|
|
|
|
|
can I use this:
MT_EVENT evt = new MT_EVENT();
uint length= (uint) Marshal.SizeOf(evt);
|
|
|
|