|
Firstly, that appears to be a nasty bit of code. No wonder you're confused. If I were you I'd do some research, some learning & then rewrite it properly.
strSQL is being used here as an SQL Select statement[^] that retrieves data, in this case an email address, from a database (I'm guessing Access) using a Command Object[^].
Why is this code is bad? Here's a few reasons off the cuff - I'm giving you these (and a few links for your benefit) to point you in the right direction when you rewrite it
1. The function is being passed an argument (strUsername) that is never used.
2. There is no input validation being done on the email address in the SQL statement which opens the database up to SQL Injection[^].
3. There are no Try...Catch...Finally[^] blocks - standard practice when working with a database.
I shudder to think what the rest of this code looks like... Good luck.
|
|
|
|
|
I use Dundas charts and I get this error:
Access to the path 'C:\Inetpub\wwwroot\Project\Control\GaugePic_000006.png' is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access to the path 'C:\Inetpub\wwwroot\Project\Control\GaugePic_000006.png' is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true">, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
It says something about a security tab but I don't have a security tab.
|
|
|
|
|
Are you and Administrator? What version of Windows? What version of IIS?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Hey buddy try following, after doing this security tab should start coming, if it still does not come, please reply back
[To Display the Security Tab: Start/Settings/Control Panel/Appearance & Themes/Folder Options. View/Advanced
and clear "Use Simple File Sharing".]
Now go to desired folder, right click on it and select Properties. you must be able to see security tab now.
Vikas Sharma
|
|
|
|
|
@vikasparth
It worked!
Thank you both!
|
|
|
|
|
How to Trap Key-Press for validating each digits in Text Box.
I want help for this with C# coding.
Its Amazing World of ASP.NET C#
|
|
|
|
|
Just validate everything at the end. Before you do anything with the data. If you were to hook on to keypress you would create way too many postbacks.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Try using javascript. This is how you should do......
TextBox1 txt=new TextBox();
txt.Attributes.Add("onkeypress","return ValidateForm(event)";
In javascript
function ValidateForm(e)
{
var unicode=e.charCode? e.charCode : e.keyCode //determine keycode
if ((unicode>=48&&unicode<=57)// Allow only numbers
return true;
else
return false;
}
|
|
|
|
|
Use a RegularExpression validator control with the RegEx "^\d$"
only two letters away from being an asset
|
|
|
|
|
|
I think you can put a semi column after one and start the next right after. What two types are you trying to do? Usually you can combine them.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Or you could just create two queries & call both in code one after the other.
|
|
|
|
|
Or create a stored procedure that can execute 2 queries.
Regards,
Arun Kumar.A
|
|
|
|
|
Thank for you taking ur time to help me
|
|
|
|
|
OnPreInit() and Init() wat is the difference..A control is intialized to its design defaults and postback data is not available in both cases then wat is the major difference between them..
LoadViewState and LoadPostBackData..i am really confused
protected override void LoadViewState(object savedState)
{
base.LoadViewState(savedState);
}
This event is never getting fired for me
if a textbox value is changed in a button click. Who is responsible for storing the textbox value.
what is diff b/w data stored in view state and data stored in a control that implements IPostBackDataHandler.
|
|
|
|
|
The major difference is that preinit is fired first. It was added just to give finer grained control.
LoadViewState won't fire unless you're posting back, as there can't be any viewstate to load.
vikasviswan wrote: if a textbox value is changed in a button click. Who is responsible for storing the textbox value.
It will be stored in viewstate, so long as viewstate is turned on for the page and the control.
vikasviswan wrote: what is diff b/w data stored in view state and data stored in a control that implements IPostBackDataHandler.
Probably nothing, viewstate is the only state in town, except control state, which is just a subset of what 1.1 stored in viewstate, so you can turn some of it off and not the rest. Control state is really still viewstate.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i have a textbox and 2 buttons.
In the first button click ,i am changing the textbox value to hello.
Second textbox is just doing a postback no code.
Code is below
protected override void LoadViewState(object savedState)
{
base.LoadViewState(savedState);
}
protected void Page_Load(object sender, EventArgs e)
{ }
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text = "Hello";
}
protected void Button2_Click(object sender, EventArgs e)
{ }
I turned Enableviewstate of page to false;
I noticed that when i click the first button textbox value changes to "hello" and when i click the second textbox it is still retaining the value "hello". How is this possible without viewstate ..
Then i turned Enableviewstate to true. In both cases LoadViewState is never called, i tried a lot...Can u pls give me a sample example where LoadViewState would be called
|
|
|
|
|
Perhaps the text is stored in control state ? That's possible, I'm not that sure of what goes in there.
I'm about to go out, otherwise I'd whip up a sample for you. I recommend googling for LoadViewState.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
I did this & got this without much trouble.
Hope that helps.
|
|
|
|
|
Regarding difference between VIEWSTATE and CONTROLSTATE, one differnec which i am aware of is, VIEWSTATE can be handled, edited, accesed by programmer while CONTROLSTATE can not be accessed, edited or disabled directly but it is maintained by .NET framework.
VikasParth
|
|
|
|
|
in asp.net 2005 ImgeditLibCtl.dll is included for displaying image in active x control (kodak image control coming with image professional) i am unable to display the image pls kindly help me
sathish
|
|
|
|
|
Consider using a sensible subject in future. Odds are, your question in this forum, relates to ASP.NET.
Your first step is probably to tell us what *does* happen, does it blow up, does it do nothing ? I mean, if this is an active X control that is installed on the machine yuo're using, it should work, to know why it's not, we need to know more details than 'I am unable to display the image'
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I HAD ACTIVE X CONTROL I CHOOSED IN REFERENCE BUT IT NOT DISPLAYED IN TOOL BAR SO I AM UNABLE TO PLACE THE TOOL IN WEB FORM PLS BUT IT SHOW IN SOULTION EXPO. WHY I ANABLE TO PLACE TO CONTROL PLS KINDLY HELP ME
SATHISH
|
|
|
|
|
Shouting[^] won't make your question any easier to understand.
I'm gonna go out on a limb here and assume you can't see a particular control in your toolbox that you're expecting to see. Try right-clicking over the toolbox, selecting "Choose items...", browse to the library containing the control & opening.
That said, bear these two thoughts in mind:
1. Are you sure there is a control in that library that you can add to your toolbox?
2. You want to place this on a Web form - chances are the people accessing your web form won't have the ability to see this control on the client side so what exactly are you trying to gain?
|
|
|
|