Showing posts with label time. Show all posts
Showing posts with label time. Show all posts

Saturday, March 31, 2012

Web server busy

Hi, I created access database and let people checkin and checkout. I created four buttons, but every time it seems that when people clcik the second one, it gives web server is busy message. It takes quite a while to retrive the page and then check in. It seems that not many people check in at that time. Would any expert look at my code? I really appreciate it and thanks!!!!

Sub Check_Test(sender as Object, e as EventArgs)



Dim currEmpNumber As String = employeeID.Text

currEmpNumber = checkUserInput(currEmpNumber.Trim())

strSQL="Select * from Employee WHERE IDEmployee= '" & currEmpNumber & "'"



call openDB()

Dim objDR as OleDbDataReader
Dim Cmd as New OleDbCommand(strSQL, connTemp)

objDR=Cmd.ExecuteReader(system.data.CommandBehavior.CloseConnection)


While objDR.Read()
currName=ValidateInputForDB(objDR("Name"))

End While

call CloseDB()

Call OpenDB()



strSQL="Select IDEmployee from Employee WHERE IDEmployee= '" & currEmpNumber & "'"
Dim myCommand1 As New OleDbCommand(strSQL, connTemp)
currEmpID = myCommand1.ExecuteScalar()
If currEmpID = 0 Then
labelMessage.text = "<blockquote><font size=6 color='blue'><b>* Wrong No! Please try again!</font>"
labelMessage1.visible=false


Else
Dim myCountEmployee as Int32 = 0


strSQL="Select count(*) from Clock WHERE IDEmployee= '" & currEmpNumber & "' and serverDate = '" & currServerDate & "'"
Dim myCommand3 As New OledbCommand(strSQL, connTemp)
myCountEmployee = myCommand3.ExecuteScalar()


If myCountEmployee = 0 Then

labelMessage.text = "<blockquote><font size=6 color='blue'><b>* Sorry! </font>"
labelMessage1.visible=false
else

If myCountEmployee > 0 Then

strSQL="UPDATE Clock SET OutWork1 = '" & currServerTime & "' WHERE IDEmployee= '" & currEmpNumber & "' and serverDate = '" & currServerDate & "' and Outwork1 = '' "

call InsertUpdate(strSQL)

call CloseDB()

End IF
end if
end if
labelMessage1.text ="Bye, " & cstr(currName) &"!" & " "


End Sub

hi,

i'm not an expert, i'm neither familiar with VB. I'm coding in c#, but it looks to me that you don't close the db connection every time.

If myCountEmployee > 0 Then

strSQL="UPDATE Clock SET OutWork1 = '" & currServerTime &"' WHERE IDEmployee= '" & currEmpNumber & "' and serverDate= '" & currServerDate & "' and Outwork1 = '' "

call InsertUpdate(strSQL)

call CloseDB()

End IF

it think the connection is closed only when there are any employees ?

And it is opened before the if, so it should be closed not in the if clause.

If my assumption is right, it is possible to run out of sql connections very soon, which may causes your problem.

If i'm wrong sorry for puzzling you more :)

Cheers,

Yani

Wednesday, March 28, 2012

Web server problems

Hi,

I am using web matrix to develop my web pages. Each time that I made any change on my aspx pages I need to restart the server (Web matrix server), if not it does not display the changes.

Does any one know how to avoid this problem?

Thanks for your help in advance

EnekoHavnt used web matrix server before. Have you tried IIS5, this is what I use and its a very effective server. Simply build your pages and then put them on there and view them. IIS5 ships with win2000 and i think some versions of XP.
At the moment we still in testing face. I am thinking to use IIS soon but I am quite scare about the compatibility with asp pages.

We are using IIS to run asp based projects. Do you know what do I need to do to become IIS compatible with aspx pages? Do you know any incompatibility problem?

Thanks for your help, as you can see I am new with asp.net.

Eneko
There are no incompatability issues with IIS and the use of .net. I am running Win2k with IIS5 and .net 1.1

All you have to do is install the .net framework on your pc and you are up and running. I made the transition from ASP3.0 to asp.net quite easliy.

Make sure you have IIS & the .net framwork onyour. Thats all

Web server time

can anyone please tell me how do i get the date/time of the web server hosting the website... i know the function Now() get the client side time.. but what if i wan the server-side time... please help...Have a look at this (http://www.w3schools.com/js/tryit.asp?filename=tryjs_timing_clock)
but that is in javascript.. what if my page language is in vb???
can i find out whether there is any code which will display the GMT of the client.. ex: my gmt is +8 so when my computer request from the server it should display GMT+8...
DateTime.Now does not give client time. It will give you the server time.

To get the time zone of the client, you need to use javascript.

var d = new Date();
alert(d.getTimezoneOffset());
sorry when it come to prgramming for time i am quite a noob..u mind give me the full syntax for DateTime.Now ??
u mind give me the full syntax for DateTime.Now ??

DateTime.Now

Yes, that is the syntax. To display it, you can use

DateTime.Now.ToString()

or

DateTime.Now.ToShortDateTimeString()

and other available methods which should be visible to you in the intellisense.

Monday, March 26, 2012

Web service Backward compatibility

Hello,

I wrote a web service in .net 2.0, it works good.

When trying to web reference it from application written with .net 1.0, I get a time out.

Is there a backward compatibility problem?

Thanks

Philippe

Yes. There are many differences between the two frameworks. You'll either need to redo your web services in .NET 1.1, or upgrade your application to 2.0.


Thanks !!

Saturday, March 24, 2012

Web Service Problem

Hi, i created a web service and i published it, and i created a client. when the client calls the web service for the firs time everything is ok, but when the client calls the service for the second time the service is not responding, can someone help me please.On the second time, does it time out? Give an error? What happens?

How does the client call your web service?
I think it does time out. It can't find the service. the client calls the service through an instance of the service in client code
Can you put up some of your code from the client calling the webservice.

It could be something as simple as you missing the 'New' keyword when creating an object of the webservice. At least i think I had that problem when I initially started and I think that's what the solution was.

Thursday, March 22, 2012

Web Service Ref.

Afternoon,

I have a ObjectDataSources tied to a xyz.service at design time by adding webRef.

At runtime is it possible to change the URL of xyz.service.

I have SAME service running on multiple servers, and transactions are site specific so based on transaction type I have to switch the URL of the WebRef added at the desgin time or initially added on web.config.

Any other alternate or help would be appreciated.

Regards,

ZEB

qzeb:

Afternoon,

I have a ObjectDataSources tied to a xyz.service at design time by adding webRef.

At runtime is it possible to change the URL of xyz.service.

I have SAME service running on multiple servers, and transactions are site specific so based on transaction type I have to switch the URL of the WebRef added at the desgin time or initially added on web.config.

Any other alternate or help would be appreciated.

Regards,

ZEB

qzeb --

Here is an alternate design that might solve your design problem.

For such a design, one could probably use just one web service as a TrafficRouter. All web service consumers call the same service, the TrafficRouter, passing in a parameter that is TransactionType. Have the TrafficRouter run the switching logic and route to the correct URL (or ClassLibrary code) based on the given TransactionType. One could manage the set of URLs in the TrafficRouter's web.config file, (provided the list of URLs is not too long) or one could keep the URLs in a database and have the TrafficRouter lookup the correct URL based on the given TransactionType key. And so on.

This pattern has the added advantage of minimizing surface area exposure, which is a generally desirable design goal. All one has to do is expose one web service, the TrafficRouter. The others services can live securely behind a firewall on the friendly site of the physical architechture.

HTH.

Thank you.

-- Mark Kamoski


Thanks for quick response; I had thought about it; but its kind of late & worth to Explore around.

Regards,

ZEB