|
|
Hi All,
Iam new to asp.net2.0, Could u pls give information about Master page concept.
Thanks In Advance for ur replay,
|
|
|
|
|
if your national is persian say me to help you in farsi language
We Can Do Anything, If We Want It
|
|
|
|
|
|
|
|
Hi,
I am having a problem to update a field in the database, my code is
sqlString = "UPDATE [user] SET logindt='10/9/2007 2:39PM' WHERE email='abc@yahoo.com'"
myCommand = New SqlCommand(sqlString, myConnection)
myCommand.ExecuteNonQuery()
Response.Redirect("main.aspx")
The thing is the page just sort of refresh itself after I click 'Log in' and did not show any error message but the logindt is not updated still.
Could it be permission problem or something else?
Please help me out on this, I'd been cracking my head wondering why since no error message shows.
J Liang
|
|
|
|
|
Hi,
Please post the code you wrote when login button is clicked and also the code under page load of login page.
Mubashir
Every job is a self portrait of the person who did it.
|
|
|
|
|
Hi Mubashir,
Thanks for the reply, here's the code
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim dr As SqlDataReader
Dim currdt As DateTime = DateTime.Now
myConnection = New SqlConnection("server=localhost;uid=aa;pwd=abc;database=ww;Data Source=mysource")
myConnection.Open()
Dim sqlString = "SELECT * FROM [dbo].[user] WHERE email='" & Me.txtEmail.Text & "' AND password='" & Me.txtPwd.Text & "'"
If Me.txtEmail.Text = "" Or Me.txtPwd.Text = "" Then
Me.lblmsg.Text = "Please fill in your email and password"
Else
Try
myCommand = New SqlCommand(sqlString, myConnection)
dr = myCommand.ExecuteReader()
dr.Read()
If dr.HasRows Then
'Set session for later use
Session("uid") = dr(0)
Session("name") = dr(1)
Session("deptid") = dr(2)
Session("title") = dr(3)
Session("grpid") = dr(4)
Session("category") = dr(5)
Session("email") = dr(6)
'Update login time
sqlString = "UPDATE [user] SET logindt='10/9/2007 2:39PM' WHERE email='abc@yahoo.com'"
myCommand = New SqlCommand(sqlString, myConnection)
myCommand.ExecuteNonQuery()
Response.Redirect("main.aspx")
Else
Me.lblmsg.Text = "Email and password incorrect"
End If
dr.Close()
myConnection.Close()
Catch e As Exception
Me.MsgBox(e.ToString())
End Try
End If
Hope this is what you need.
J Liang
|
|
|
|
|
HI,
Your code seems to be fine, Try and run the UPDATE sql in the SQL Query Analyzer and see wat it do. May be it is not fulfilling the WHERE criteria so check the aphabet case as well for the email field.
Mubashir
Every job is a self portrait of the person who did it.
|
|
|
|
|
Hi,
I'd tried running the SQL script using the Enterprise Manager and it works fine, the database is being updated, that is what makes me so confuse on what is wrong with my site.
|
|
|
|
|
ic..
Use the following suggestions
- Are you able to select records from the DB? the idea is to check whether the code is connected with the DB alright. If NO then use the following connection string
"server=yoursvr;uid=uruser;pwd=urpwd;database=SomeDB"
- Try and debug to see whether the Update cmd is executed/parsed or not.
Best of luck
Mubashir
Every job is a self portrait of the person who did it.
|
|
|
|
|
Hi Mubashir,
Thanks for the suggestions. I sort of got it working and the database is being updated as I want it to be.
The thing is when I run two SQL command in the same page, it will not work, so I separated both the SQL command into different page (it's not an issue for my case whether where the command is), so it check the email and password and login to the main page then only it updates the date time.
Still wondering why it doesn't work at first, but anyway, I shall find out myself.
Thanks.
J Liang
|
|
|
|
|
Strange issue, but good that its working.
Mubashir
Every job is a self portrait of the person who did it.
|
|
|
|
|
Did you check the query with Select Clause to see indeed if some records match up your where clause?
|
|
|
|
|
Hi Kumar,
After continuing my project, everything went fine. What I suspect is it was a bit messy, so after I clean things up everything is working fine and I can have a few sql command at a same page.
J Liang
|
|
|
|
|
Hi all
I want to get alert when my web page is idel for 20 min
How it is possible
help me please
Sunil Tvl
|
|
|
|
|
sunilTVL wrote: I want to get alert when my web page is idel for 20 min
Who should be alerted ? You or User ?
|
|
|
|
|
|
i use from this method:
ManagementObjectSearcher MainBoard = new ManagementObjectSearcher("Select * From Win32_BaseBoard");
foreach (ManagementObject mbProperty in MainBoard.Get())
{
lblMbName.Text = mbProperty["Name"].ToString();
lblSerialNumber.Text = mbProperty["SerialNumber"].ToString();
}
the name of mainboard detected but lblSerialNumber.Text always is null, why?
We Can Do Anything, If We Want It
|
|
|
|
|
Hi if i select month and year based on that...,
i need that month all dates in my datagrid...,
Plz help me...,
Magi
|
|
|
|
|
your question is unknown.
We Can Do Anything, If We Want It
|
|
|
|
|
Hi see in one of drop down list box i will select month...,
Another dropdown listbox i will select year...,
Now based on this two inputs,i want to display that month all dates in my datagrid....,
Now u got it my qeustion????????
Plz help me...
Magi
|
|
|
|
|
hi
how can i create a menu ribbon in asp.net without using a third party tool
thanks
|
|
|
|
|