SQL Server :: Change Value On A Variable?
Nov 25, 2010If SubTotal is more than 500 I want @freightPrice to be 0. How can I do that?
[Code]....
If SubTotal is more than 500 I want @freightPrice to be 0. How can I do that?
[Code]....
I'm evaluating two options of accessing a server side data on client side. Little bit confused about the efficiency or may be you can call it as finding best approach to do it.
I need to access a server side data may be an integer value in javascript on client side. I know about two options to do it.Create a public variable or property on server side and set it to javascript variable on client side as below:
var value = eval(<% =value %>);
Create a asp hidden variable and set value in this hidden variable from server side and access it through javascript using document.getElementById().
Which is the best approach and what are the pros and cons?
How would I change "newTicketId" to a bigger font and color blue?
[code]....
I want to Change application variable value on closing browser, Problem is; I am using sessionState mode="StateServer" and in this mode, Session_end event does not fire in global.asax
how i can detect session_end or browser close and then change the application variable?
I want to save the current date to a table in database. The coloumn type is declared as DateTime in the table, as i may have to select rows between two dates. So i can't change the format by converting it to string variable. I want the DateTime.Date variable to have dd/MMM/yyyy hh:mm tt format instead of MM/dd/yyyy hh:mm:ss tt format.
View 3 Repliesi have 2 ASP pages in first page the user choose the database name and in other page take the database name and change the connection string to other databasehow i can pass a variable from one page to other by button click and how i receive this variable in other page and how to change the connection stringthe connection string is in web.config like this:
<connectionStrings>
<add name="Northwind" connectionString="Provider=sqloledb;Data Source=.;Initial Catalog=Northwind;User Id=sa;Password=sa; Connect Timeout=10"/>
</connectionStrings>
I want to change the text of a linkbutton by referring to it through a session variable.
For example how could a normal Linkbutton1.text = "buffoon" be referred to by a session variable if the Session("LinkButton") = "LinkButton1" ?
I am envisioning something like: LinkbuttonByName(Session("Linkbutton").text = "bufoon" .... but don't know how
I want to access drop down menu's variable in java script on change event, here is my code
<asp:DropDownList ID="DropDownList1" runat="server" onchange="document.location.href = url_Lookbook;" >
<asp:ListItem Value="0">hello</asp:ListItem>
<asp:ListItem Value="1">world</asp:ListItem>
</asp:DropDownList>
here is the script coding:
<script type="text/javascript">
var url_Lookbook = "http://microsoft.com";
</script>
My question is how do I pass down value=0 or value = 1 to different page
I'm trying to change a row in detailsview based on a value in a coloum. Exactly the same as this example but in Detailsview: [URL]
View 3 RepliesWe recently migrated a web app from one Prod server (Prod 1) to another server (Prod 2). There is a session varialbe checked inside the page load event of the default master page. I have enabled session state both in web.config as well inside the pagedirective. The compilation went through without any issue. The web app is also running just fine on the server but the log file keeps logging a warning message. There is no run time error.
"System.Web.HttpException: Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration><system.web><httpModules> section in the application configuration."Any idea why this is happening on one server vs other?
I am using the following code to change the header based on the session variable
[code]....
I'm trying to change an image's imageurl on an aspx asp.net c# page based on a variable from #var=1` (or 2, or 3, or 4)
I know nothing about javascript unfortunately which is what I've been told I need. Can anyone point me at a novice based script I can try to learn via implementation?
I want to use a local sql variable in XQuery.
Following is my table structure with columns and data type.
Orders
ID
Uniqueidentifier
UserID
Uniqueidentifier
OrderDetail
XML
OrderDate
DateTime
OrderDetail column contains XML in the following form.
<Books>
<Book BookID="033ba62a-3bbe-48cc-ad15-c3f28ff86306" Title="XYZ" Price="120" />
<Book BookID="805BC2BE-A91E-4E0E-A99E-C290D2EEEFF6" Title="XYZ" Price="120" />
</Books>
I want to select Orders (rows) which have BookID = "033ba62a-3bbe-48cc-ad15-c3f28ff86306". I am able to achive it through the following query.
Select * From Orders Where OrderDetail.exist('//Book[@BookID = "033ba62a-3bbe-48cc-ad15-c3f28ff86306"]') = 1
Now the issue is I want to use an sql local variable (@BookID) instead of the hardcoded BookID.
So How I can use a sql variable in a XQuery.
I need to pass a table type parameter to a user-defined table valued function in SQL Server 2005.How would I do this?
My function name is udf_t_GetSales ( @financialYearMonthsData as table)
The table @financialYearMonthsData has 3 columns ( MonthId int, DisplayText nvarchar(500), CalendarYear int)
[Code]....
Above is dynamic sql and when it is executed by sp_executesql then I got output as as xml. If I want to store that XML in a variable. So then what I need to add in my tsql script.
I've defined a session variable in my Session_Start procedure
void Session_Start(object sender, EventArgs e)
{
<other stuff>
string sAdmin= bAdmin.ToString();
Session["SessionAdmin"] = sAdmin;
}
Then in my masterpage I want to use the Session Variable to conditionally show some links in a list.
How do I write the Boolean expression to correctly access the session variable SessionAdmin?
Here's what I have:
<div id="menu">
<ul>
<li><a href="/EmployeeTime.aspx">Employee Time</a></li>
<% if ( *** a Boolean expression involving Session variable "SessionAdmin" *** ) {%>
<li><a href="/Employee.aspx">Employees</a></li>
<li><a href="/ProductLine.aspx">Product Lines</a></li>
<li><a href="/Task.aspx">Tasks</a></li>
<li><a href="/Type.aspx">Work Types</a></li>
<li><a href="/Activity.aspx">Activities</a></li>
<%} %>>
</ul>
</div>
How do I correctly define my boolean expression? I've been looking, but haven't found the right syntax.
I want to use session variable for ConnectionStrings in SqlDataSource, so the same script can be used with different users with different databases. My SqlDatasource code is :
<asp:SqlDataSource
runat="server"
ID="sdsAvdeling"
SelectCommand="SELECT
* FROM [Avdeling] ORDER BY [Avdeling]"
ConnectionString="<%$
ConnectionStrings:UtstyrConnectionString %>">
</asp:SqlDataSource>
In Page_load, I assign the connectionstring for the SqlDataSource like:
sdsAvdeling.ConnectionString = Session["ConString"].ToString();
where
Session["ConString"]
is assign to "UtstyrConnectionString" when the the user logs in. When running the script, I get the following error: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.
how to Declare scalar variable
[Code]....
I would like to run a SQL query on the codebehind VB page that will also set a value from that query to a Session variable. Also, this needs to be done on the Page_Load.
Example:
[Code]....
sales.aspx.vb
Custom function which stores the current DATE into todayDate. I use this function to convert system date into SQL friendly date.
sales.aspx
I used Data Grid and SQL Data source.
SelectCommand="select * from sales where aab = 110026"
I want my select statement should take the date from todayDate.
i.e.: SelectCommand="select * from sales where aab = todayDate"
How to write this statement in correct syntax.
i am wishing to store the query result in any variable, have look at below code.
[Code]....
I have marked the code with bold, where I am getting error.
how do I store query result in any variable.
This should be really simple and I am new to asp development.
I am using ASP log in controls..when user logs in, I am storing the userid in a session variable. On this another page, I want to put the previously stored session variable value into a table using Insert statement.
in my sqldatasource..here is the code..
InsertCommand="INSERT INTO tblMain(PatientId, UserId, IncAge, IncDeNovo, IncAnginaIschemia, IncNative, IncLesions, IncStudyConform, IncStenosis) VALUES (@PatientId, @UserId, @IncAge, @IncDeNovo, @IncAnginaIschemia, @IncNative, @IncLesions, @IncStudyConform,
@IncStenosis)">
I want to recongize that a nvarchar variable in stored procedure is null or not null.
and this example :
DECLARE @Count int;
SET @Count = (SELECT Count(Fld) FROM Tbl)
if there is no row how much whould be the value of @Count?????
zero or null?
Inside a function I need to check to see if a variable value is null, how to do this? I implemented the code but its not returning the value I thought it would return.If it's null I want to set the value of the variable, else I want to query the value from a table
[Code]....
I have this procedure
[Code]....
I don't know what variable should be put in where clause for tblVisitor.visitorID because there's a variable that was already passed by an output identity parameter by a different stored procedure. What will I put in the where clause for visitor id?