i have a datetime column which has dates with milliseconds, but when i make a query and try to read that column i get the correct datetime but without dhe milliseconds.
I use a conversion like this: DateTime oColumn =DateTime.Parse(oRow["Start"].ToString());
Is there anyway to get the milliseconds from the column.
When I select from SQL Server, I want to get a date, but omit the millisecond value, and I want it to be as a date type. So if I have a value 1/1/2009 1:23:11.923, I want to omit the millisecond but retain the date type, so that it will be the value 1/1/2009 1:23:11.000 (I know you really can't omit the millisecond value with a date, just want it to be zero).
Is there a function in SQL Server to do this? Or do I have to write my own function? Again, I don't want it as a varchar type, but a datetime type.
By right clicking on my database i created a query in server explorer. But where are this query stored can't find them back. I should aspect that their is a folder query's like there is a folder tables but this isn't the case.
I am trying to create statitics for game downloads and am having dificulty with a sub part of my query. the goup by command is not having the disired result and i think i have been looking at it too long to see what i am doing wrong. [Code]....
At the moment it is producing each result in many rows when only 4 rows should appear. its the download column that is doing it. needs to be sub queried or something to display total in relation to month,gameid,userid.
I am trying to display this query result in an aspx page.
It is very slow in loading. Here is the query. The inner query inside the outer quesry is the problem.(Please see the underlined part in the query) - (If I remove that part it is very fast.)
select
top 500
--This column is the issue ,Governing_Class=( case when exists (select top 1 tqc.class_code from t_quote_class tqc inner join t_quote_class_premium tqcm on tqc.class_code =tqcm. class_code where tqc.appid=pi.appid and tqc.class_code not in('8742' ,'8810','7380') order by tqcm.premium_amt desc ) then ( select top 1 tqc.class_code from t_quote_class tqc inner join t_quote_class_premium tqcm on tqc.class_code =tqcm. class_code where tqc.appid=pi. appid order by tqcm.premium_amt desc ) ......... From tables
I am a biggner in SQL DB . but i started a complicated and painfull work in SQL SERVER 2008. the problem convert Oracle hierarchical query to SQL query. the query
SELECT DISTINCT LEVEL LVL, SCH.NSCHEDULE_SL, SCH.NSCHEDULE_SL_FM, SCH.CSHED_CNAME FROM FA_SCHEDULES SCH WHERE LEVEL = 1 AND NSCHEDULE_SL_FM IS NULL AND NBRANCH_SL = 2 CONNECT BY PRIOR SCH.NSCHEDULE_SL_FM = SCH.NSCHEDULE_SL AND NBRANCH_SL = 2
I'm having a weird problem with one of my .net windows applications. I store a number of settings in the application settings (User Scope) but from time to time the settings just seem to dissapear when it's run on the server.
I have a webservice (ASP.NET) deployed on a webfarm. A client application consumes it on daily basis. The problem is that some of its calls are duplicated (with difference of milliseconds). For example I have a function Foo(string a,string b). The client app calls this webmethod as Foo('test1','test2') once but my log shows that it is being called twice or sometimes 3 or 4 times randomly. Is this anything wrong with the webfarm or the code? Note that the webmethod has simple straighfarward insert and update statements.
I have a page, where I dynamically add textboxes within an updatepanel with a button.click event. Those are common telephone, fax, email, etc.. Now I put in some values, store those in Session with Arraylist and go to next page. Here, there is a button to go back to previous page. Ive managed to recreate all those textboxes on Page_Load event, using if not page.ispostback, then.. Now, this problem is driving me crazy. When I load my page, put in some values, add as many textboxes, as I want and go "Next", its ok. Then I go "Back" and everything is recreated and I see as many values within textboxes, that I created. But when I do this for a 2nd time, I can only see recreated textboxes without values. Ive spent some time searching for a simple solution, or an advice. But with no success. I could post some code here, but its a bit long and complicated. But if necesarry, I will.
I basically have an update panel being dynamically populated with a LinkButtons after a postback. This link buttons are being assigned an event. Now when I click the button the event is not firing. As I understand it the event is not firing because I'm not creating the button in the Page_Load event and therefore .Net does not remember this controls were created after postback. I'm not able to create these controls in the Page_Load as they are dependant on user input. So my question is how can I create these controls dynamically and have the page retain them and their events after postback?
this is about ASP.NET, ViewState, UserControls and loosing the values of my properties. It is an classic question by know, I know, and even though I have searched here and on Google for a resolution to this problem, I havent succeeded. On the contrary, the more I test different things, the less I understand it seems.
On top of this I am using ext.net and their so called DirectMethod's but I dont think that has much to do with this problem. There are numerous questions I have and I hope that this text will be fairly readable and understandable =)
The UserControl
I have a UserControl, Customers.ascx, that contains some Properties. The "most" important is *_CustomerId*. The _CustomerId is set in code-behind, in ext.net's "DirectMethod" like this (code below from the Page Customers.aspx):
I have a asp.net page with a codebehind. I have 2 buttons on the page. When clicking on button 1 I get some data from my database and save it for later use in Sessions.
I've created a gridview and one of the columns displays a field called "usegolive". In the table this value is either 1 or 0.I'd love to know how to convert this so it's displayed as either "yes" or "no" without loosing the underlying values. Seems fairly straightforward but I cant figure it out.
I'll try to specify my problem as simple as possible! I have a problem comunicating between 2 pages; Products.aspx and ProductDetail.aspx. On Products.aspx i have about 15 DDL's on the left side (all set to autopostback), and 1 ListView ond the right side. Results in my ListView control are based on selcted items from DLL's on the left. Every single result in Products.aspx has a dynamical hyperlink to the ProductDetail.aspx. Now when I click on specific product in ListView I'm redirected to ProductDetail.aspx page, and everything works fine! If I click on the Back button in IE or FF it works also fine because it returns me to the previous Products.aspx page and all my results based on selected items in DDL's are still there!
The problem comes when causing some more autopostback's in ProductDetail.aspx page, because every autopostback is counted as a new page request and therefore i have to click Back button in IE or FF for more then 1 time to come back to the previous Products.aspx page.
I tried to implement code BELOW in ProductDetail.aspx.vb but it does not completly fulfill my expectations, becase all my searching criteria are lost when returned to the previous page (Products.aspx)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then ViewState("ReferrerUrl") = Request.UrlReferrer.ToString End If End Sub Protected Sub BACK_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BACK.Click Response.Redirect(ViewState("ReferrerUrl").ToString) End Sub
Does anybody knows any other solution how to come Back to previous page with only ONE CLICK without loosing searching criteria?
Am new to asp.net.I am creating a site using asp.net(C#), in master page i have treeview control, when i select a item i navigate to url. But selected node is lost, it reset itself, loosing state.
I have an ASP.Net site that has master pages. The master page has some calls to functions to get information from a database. Then in one of the parts of the master page I have form that modifies that information. So when the user clicks a button the information in the database is updated but the display of that information doesn't update until the page is refreshed or another link is followed.
I would like to know how to force a page to refresh without loosing VIEWSTATE information so that the newly updated data in the database will appear correctly on the screen.
I am using JavaScript's PageMethod functionality where I am invoking a PageMethod which works like a gem. However I am having an issue in accessing the HttpContext's state which returns me a value "SYSTEM" for
HttpContext.Current.User.Identity.Name
which is not the actual current User Name.
I know there are couple options like storing HttpContext.Current in a Session or saving Context's state in some other custom container but given a web farm environment I am assuming that this will not work as expected.
Here is the code I am working on with
function MyFunction(){ PageMethod.MyPageMethod(); }
here is the signature of the server method
[System.Web.Services.WebMethod()] public static void MyPageMethod() { // gives me "SYSTEM" var user = HttpContext.Current.User.Identity.Name; }
Also if I use the above code to access user name in OnLoad event of the page then it works fine and returns me the CurrentUserName.
I am trying to get the above code to work in an ASP.NET Webform... :)
So I am wondering if there is a way to access the current actual user in page methods without making use of sessions.