|
How is top 1 a wise way to get the record you want ? The best bet I would say, is to get the Id into a variable, then use that to do the update, probably in a stored proc.
Oh, I take it back - top 1 is just a waste of time, you specify the id. So, this is SQL 101, a standard update statement that specifies the Id of the record to update. Judging from the SQL you're using here, you really need to buy a book on SQL. Your current statement should be
select id, value1, edate from tablename where empid = 100
No other SQL is needed. It's certainly stupid to use top 1 and order by in the same line, how does the order matter when you asked for one record ?
update tablename set value1=2500, edate=getdate() where empid = 100, would update the record with a value of 2500 and the current date. Promise now that I told you this, you'll take the time to learn some SQL before working on databases anymore ?
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
update tblname set bassalary=10001
from (Select top 1 * from tblname where empid=100
and (datepart(yyyy,edate) < 2006 or (datepart(yyyy,edate) = 2006
and datepart(mm,edate) <= 11)) order by edate desc) as th
where tblname.edate=th.edate
It will work...,
Magesh
|
|
|
|
|
Hi All!
I am reading a data from the database the string read is then passed to javascript function. This data(string) may contain a return white space i want to replace this return character with a <br> tag. Is there any Method to do this
Regards
|
|
|
|
|
return and whitespace are two different things.
The Replace function on the string class will let you change instances of Environment.NewLine, or whatever, to break tags, or anything else you'd like
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Thanks a lot for the reply. It Worked!!
Regards
|
|
|
|
|
I am trying to set up an ObjectDataSOurce that would call the following method:
public static Collection<t> Get<t>(eLookupTypes eLookupType, int Category_Unique_ID, bool IncludeCreateandModifiedInfo, ref CustomException oCE) where T : LookupwithCategory,new()
my oDS lookis like this:
<asp:objectdatasource id="dsAddressTypes" runat="server" selectmethod="Get" typename="ProjectCentral.Address.Address_Type">
<selectparameters>
<asp:parameter defaultvalue="7" name="eLookupType" type="Object">
<asp:parameter defaultvalue="1" name="Category_Unique_ID" type="Int32">
<asp:parameter defaultvalue="false" name="IncludeCreateandModifiedInfo" type="Boolean">
<asp:parameter defaultvalue="" direction="InputOutput" name="oCE" type="Object">
I don't know how to setup the ODS to declare the constraint type , T.
Secondly how do I assign the last Param oCE?
Any help would be greatly appreicated.
Regards, Santiago "Saint" Perez Florida's Turnpike Enterprise - Santiago.perez@dot.state.fl.us
|
|
|
|
|
hi all,
I am developing a web application using asp.net 2.0 (VB).
my current page's URL some times comes with query string some times doesn't comes with query string.
It is based on some status.
I need to check My URL, whether its contain any query string or not.
If so i have to do some action based on the value.
else different kind of action will take place.
Now how can i find out My URL contains the query string...
help me out to solve this problem.
Thanks in advance
Senthilraj K
|
|
|
|
|
Check out the Request object.
If your url is: www.foo.com?myparam=something
Dim myvalue as string = "defaultvalue"
If Not Request("myparam") Is Nothing Then
myvalue = Request("myparam")
End If
myvalue should now be "something".
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Do you know the querystring variable name ? IF yes then go with previous poster suggested method. If no, you need to take Requst.RawUrl and use some regular expressions to find url contains querystring.
|
|
|
|
|
Hi, I have created a folder called myUpload in my project so that I can upoad files to it. myUpload is automatically placed in the C drive in "inetpub". I was able to load text files to the myUpload but not able to view its content in the browser. I get the exception "ASP.NET is not authorized to access the requested resource." The following are the steps I took to try to grant the asp.net account write/read access. Needless to say I failed to make it work.
I've selected: Security tab-> ASP.NET Machine Account -> Add tab -> Advance tab-> Find Now tab -> Machine/ASP.NET Account -> OK -> Allow -> Apply -> OK
I have posted this question before but the replies I recieved suggested that it might be caused by not setting the write object to NULL, after it is no longer needed. If that is the case I won't get the same exception as the one that I've got. It will be something completely different. Please help me resolve this problem, thank you in advance for your help.
-- modified at 1:56 Wednesday 8th August, 2007
|
|
|
|
|
It is probably the access level on the folder itself. Whatever context your application runs under must have write access for the folder to which you are writing (be it the aspnet user or the INET_User.
Check what user context you are running under and grant that user the security permissions on the folder.
|
|
|
|
|
I have this code on an aspx page. ( dispform.aspx in sharepoint) :
asp (colon ) Button runat="server" Text="Button" id="Button1" onclientclick=
"rdpclick(IPaddr)
Rdpclick is Javascript function.
How can I assign the IPaddr parameter to the current value of this
Sharepoint Control ?
SharePoint:ListItemProperty Property="IPAddress" runat="server"
id="ListItemProperty1"
-- modified at 17:13 Tuesday 7th August, 2007
ps I can't get the code tag showing my code in this post. Not sure why.
-- modified at 17:14 Tuesday 7th August, 2007
|
|
|
|
|
Does ASP.NET require the Java SDK? I viewed the source of an asp.net generated page only to find Javascript.
|
|
|
|
|
Java and JavaScript are two totally different things. While ASP.NET uses Javascript, it doesn't use Java.
Cheers,
Mircea
"Pay people peanuts and you get monkeys" - David Ogilvy
|
|
|
|
|
thanks you answered my question. And I mistakenly was mixing the JRE with the JAVA SDK.
|
|
|
|
|
Cfer83 wrote: And I mistakenly was mixing the JRE with the JAVA SDK.
Both are Java, and they have nothing to do with Javascript.
---
single minded; short sighted; long gone;
|
|
|
|
|
if i stored lot of data in session is that will make my web applection slow?
JavaScript - C# - MS Sql Server - asp.net 2
|
|
|
|
|
It might, how much data are you storing in the Session? It also might depend on which type of session state you are using. If it is inproc and you have a lot of RAM memory you might not have any issues. If you are using sql server and it is passing a lot of data back for the session then it would take longer.
Ben
|
|
|
|
|
Thnx for information
JavaScript - C# - MS Sql Server - asp.net 2
|
|
|
|
|
Since sessions are stored on server so too many sessions will slow down the speed of your App.
|
|
|
|
|
thnx
JavaScript - C# - MS Sql Server - asp.net 2
|
|
|
|
|
Hi. I have an issue that I can't seem to solve. I have a gridview defined in my HTML like this:
<asp:GridView id="selectedMetrics"
AutoGenerateColumns="false"
runat="server"
autogeneratedeletebutton="true">
<Columns>
<asp:BoundField HeaderText="Selected Metrics"
DataField="ClientMetricDesc" />
<asp:TemplateField
HeaderText="Category">
<ItemTemplate>
<asp:DropDownList
id="ddlCategory"
runat="server" DataTextField="RptCategory" DataValueField="RptCategory" DataSource='<%# GetReportCategories(Eval("RptCategory").ToString())> '
SelectedIndex='<%#GetSelIndex(Container.DataItem("ClientMetricDesc")) %>' >
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
As you can see I have a BoundField and a Template field. The bound field I bind to a datatable in the pageload event of the VB.NET code behind. And the dropdownlist I populate from a function. Now, since I have the autogeneratedeletebutton set to true I see delete buttons in the gridview. In the rowdeleting event of the gridview I try and print out some values for debugging like this:
Trace.Write("Object type is " & sender.ToString())
Trace.Write("Row index of row being deleted is " & e.RowIndex().ToString())
Trace.Write("The number of values is " & e.Values().Count().ToString())
Trace.Write("The number of keys is " & e.Keys().Count().ToString())
The correct row displays in the 2nd debug line above but the last 2 say zero. It says the number of values is 0 and the number of keys is 0. For some reason I can get the index to the row being deleted but I can't seem to "see" the data from the row being deleted. Anyone have any ideas? Thanks in advance.
|
|
|
|
|
I figured out the problem. I was storing the data that was bound to the gridview in a global datatable. For some reason on postback there is no data left in the global data table (I don't know why or how this happens). So I tried storing the datatable in the session and now it works great.
-- modified at 14:30 Tuesday 7th August, 2007
|
|
|
|
|
hi all,
can anyone tell me the possible contraints to redirect pages in iframe.i am not able to redirect pages in IE and it gives a lot of problems like loss of session data etc...
or
can anyone suggest me how i can hide the url of the website using asp.net1.1
and do my application navigation without using an iframe
any help or suggestions are welcome
thanks in advance.
Rama Charan Prasad
"Be happy and Keep smiling.Thats what u want be always.. "
|
|
|
|
|
Can you please explain a bit, what you realy want? So that we can suggest you a proper way. Thanks
|
|
|
|