|
How about
this.Page.FindControl("id");
Try it, I think it will find the control.
|
|
|
|
|
public partial class Administration_Controls_FileControl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
Control control = this.Page.FindControl("MessageControl");
Gives back null
Control control = this.Page.FindControl("ctl00");
That gives my masterpage Not really nice id
|
|
|
|
|
hii all
m using update query to update the new paassword in my login table on button click.
it gives error:"syntax error in upadate statement".
the code is:
protected void Button1_Click(object sender, EventArgs e)
{
string str = "UPDATE memberlogin SET Password='"+txtnewpassword.Text+"',Confirmpassword='"+txtconfirmpassword.Text+"'
WHERE MemberNo='"+txtusername.Text+"' AND Password='"+txtpassword.Text+"'";
OleDbCommand cmd = new OleDbCommand(str,conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
}
plz guide wr m i wrong...
thanks...
|
|
|
|
|
mylogics wrote: string str = "UPDATE memberlogin SET Password='"+txtnewpassword.Text+"',Confirmpassword='"+txtconfirmpassword.Text+"'
WHERE MemberNo='"+txtusername.Text+"' AND Password='"+txtpassword.Text+"'";
Set breakpoint over here. Run you appliction, Copy the str value. Put it into SQL Server Query window and check what error it is throwing. This is the way you can identify your own problem !!
As per your code goes, Please be aware of SQL Injection !!!
|
|
|
|
|
|
sashidhar wrote: LOL SAme Solution..!
With Same time
|
|
|
|
|
There is a one minute gap between the posts anyway.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
For Now We Can Help ..! If the Same error comes agani Then What?You Will Post Again..1 I will tell You The Way to solve Your Problem
1)Keep a break Point on
mylogics wrote: string str = "UPDATE memberlogin SET Password='"+txtnewpassword.Text+"',Confirmpassword='"+txtconfirmpassword.Text+"'
WHERE MemberNo='"+txtusername.Text+"' AND Password='"+txtpassword.Text+"'";
and run it..!
2)press f11 as it passes that line part Mouseover on the string str You Will Get a Magnifier click on it You Will Get the Query in popup Window.Then You Can Test It..!
|
|
|
|
|
i have given the breakpoint:it shows:
str = "UPDATE memberlogin SET Password='0003',Confirmpassword='0003'WHERE MemberNo='0003'
AND Password='0003'"
as soon as it execute the query givs error...
|
|
|
|
|
Oh.. there must be a space just before Where statement .. I guess.
|
|
|
|
|
Hope You Got the Solution as Abi Suggests..!
|
|
|
|
|
The query looks good, the only possible problem that might took place is when Parameters like txtnewpassword, txtconfirmpassword,txtusername, txtpassword comes with some weird values.
Say I write txtnewpassword.Text = "0'--"
This is what we call SQL injection. So use like this.
string str = "UPDATE memberlogin SET Password=@newpass, Confirmpassword=@confirm WHERE MemberNo=@member AND Password=@password";
OleDbCommand cmd = new OleDbCommand(str, conn);
SqlParameter confirm = new SqlParameter("@confirm", SqlDbType.NVarchar, 50);
confirm.value = txtnewpassword.Text;
cmd.Parameters.Add(confirm);
.....
...
...
.. Do this for all other parameters.
Hope you got this more clear now.
|
|
|
|
|
i tried but prom is same....
|
|
|
|
|
mylogics wrote: i tried but prom is same....
What you have tried ? Did you give a space @where section in your code ? If yes then what error is coming now ?
|
|
|
|
|
yaaa i have given space at where as u told but still it gives error:
"syntax error at upadate statement".
i also tried using sqlinjection but same...
|
|
|
|
|
You've tried using sqlinjection?
Oh...
var question = (_2b || !(_2b));
--
Mr Mackey from South Park said:
And remember children, there are no stupid questions, just stupid people
|
|
|
|
|
UPDATE memberlogin SET Password='0003',Confirmpassword='0003' WHERE MemberNo='0003'
AND Password='0003'
use this Query and run it in sqlquery window
|
|
|
|
|
Hello, this is Vikash.
I Have a windows Service running on server and I want to Control it using my Web Application on the same server.
Anyone having any idea about it.
I just want to have control of stopping, starting or pausing a windows service running on server PC.
Any help would be appreciated.
Thanks in Advance.
|
|
|
|
|
You want to control Win Services that is running on the same server where your web server is hosted ?
|
|
|
|
|
Work with ServiceController class.
ServiceController service = new ServiceController(serviceName);
service.Start() / Stop() I am not too sure that ASP.NET account will have rights to perform these.
|
|
|
|
|
From server side you have access to any process using System.Diagonistic.Process
To stop / start service from ASP.NET use this:
int timeoutval = 20;
ServiceController svcController = new ServiceController("servicename");
if (svcController != null) {
try {
svcController.Stop();
svcController.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(timeoutval));
svcController.Start();
} catch (Exception ex) {
}
}
Remember to add <identity impersonate="true"/> in Web.config.
Also check if "Enable anonymous access" is disabled and "Integrated Windows Authentication" is enabled or not in IIS.
Hope this helps you.
|
|
|
|
|
Thanks for your responses,
That helped a Lot.
I am also posting a new Query related to VBScript, please if you could just see and give me some Idea.
I am really stuck on this issue and need to take a quick decision on it.
Pleaseeeeeeeeeeeeee Help me.
|
|
|
|
|
VikashGohil wrote: Thanks for your responses,
That helped a Lot.
But ensure that the web page that controls the windows service is protected under some authentication lest any Tom, Dick or Harry can run a bot for superflous overwhelming of your web server's service control manager.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
Hello
I want to add thousand seperator in ASP .NET gridview to the value numbers. And the auto generated columns property set to true, so there are no columns that are already defined.
Waiting for the solution.
Thanks in advance.
|
|
|
|
|
In such case, modify you SQL to give you formatted output. See here[^]
|
|
|
|