Session Variable

Jun 22, 2007

Can we use session variable in reporting services.. say go to report -> properties and create a VB function that get ans set session variable.. If yes, how. If not, any workaround?

View 2 Replies


ADVERTISEMENT

Session Variable Help!!!!!

Oct 29, 2004

Hi...
I'm developing a web app with VS 2005 Beta and I do not know how to include a seasson variable value into my code.

This is my code:

Function GetData() As System.Data.SqlClient.SqlDataReader
Dim sqlconn As System.Data.SqlClient.SqlConnection
Dim SqlCommand1 As System.Data.SqlClient.SqlCommand
Dim sqlRdr As System.Data.SqlClient.SqlDataReader
sqlconn = New SqlConnection("SERVER=SRVR;UID=USR;Password=PWD;DATABASE=MyDatabase")
sqlconn.Open()
SqlCommand1 = New SqlCommand("MyStrProc", sqlconn)
SqlCommand1.CommandTimeout = 1800
sqlRdr = SqlCommand1.ExecuteReader(CommandBehavior.CloseConnection)
Return sqlRdr
End Function

MyStrProc is:

CREATE PROCEDURE MyStrProc
@MyVar int
AS
IF @MyVar IS NOT NULL
BEGIN
.................
......t12.acct_nbr IN (@MyVar)
.....
END
GO

The variable @MyVar get its value from user log info in login page, and create a session variable.

My Question:

How and where to call seasson variable @MyVar, because now I'm getting this error:
Procedure 'MyStrProc' expects parameter '@MyVar', which was not supplied.

Any help will be great.

Tks

View 4 Replies View Related

Set Session Variable From SQL Select

May 13, 2007

Hi,
I try to set a Session variable with the result of a SQL Selec statement. I tried the following, but it is not working.
Session("thisone") = SqlDataSource1.SelectCommand = "SELECT myfield FROM [mytable] WHERE ([username] = @username)"
@username is a value from a textbox. What I am doing wrong?
Thanks for your help, Chris

View 2 Replies View Related

Populating An SqlDataSource Using A Session Variable

May 29, 2008

I'm having a real problem populating my SqlDataSource and was wondering if anyone could help.  I'm sure it's something simple
First off, I created a session variable on a previous page like so Dim NewSubscribeID As Integer = Convert.ToInt32(retSubcribeID.Value)
Session("SubcribeID") = NewSubscribeID
I now want to use this session variable on another page to populate a SqlDataSource like so <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionXX %>" SelectCommand="spXX" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:SessionParameter Name="SubscribeID" SessionField="SubscribeID" Type="Int32" DefaultValue="0" />
</SelectParameters>
</asp:SqlDataSource>
Here is the problem... Only the default value gets used.
I've tried putting the session variable into a label to test that it does actually exist lblTest.Text = Session("SubcribeID")

 and it does...What am I doing wrong?

View 2 Replies View Related

Need To Write Value Of Session Variable To SQL Record

Jan 8, 2006

Each user who inserts a new SQL record from the FormView control needs to have their UserID in one of the fields of the record.  I have the user ID stored in the Session("UserID") variable.  I am having trouble finding the right way to get this done.  I have tried using a hidden text box but I can't seem to assign the value.  I have tried the Insert Parameters but that will not accept <%# Session("UserID") %> as a DefaultValue.  Any ideas would be helpful.  Thanks.

View 5 Replies View Related

Assign Session Variable Value To Update Parameter

Jun 12, 2007

Hi, I'm trying to update a sqlserver database through vb.net in an asp.net 2.0 project. I'm using a sqldatasource and am trying to code an update parameter with a session variable.
code snippet:   <UpdateParameters><asp:Parameter Name="hrs_credited" />
<asp:Parameter Name="updater_id" DefaultValue="<%$ Session("User_ID")%>" Type="Int32"/>
<asp:Parameter Name="activity_id" />
<asp:Parameter Name="attendee_id" /></UpdateParameters>
The error message that I receive is:
 Error 2 Literal content ('<asp:Parameter Name="updater_id" DefaultValue="" Type="Int32"/>') is not allowed within a 'System.Web.UI.WebControls.ParameterCollection'. C:DevelopmentCMEdataentryattendance.aspx 29 
Does anyone have an idea how to assign the session var value to the parameter?
Thanks!

View 1 Replies View Related

Passing Session Variable To Html Page.

Apr 17, 2008

Hi Folks,
i am trying to add a connection string value to my client side as follows. i am getting error. any ideas??
<asp:SqlDataSource ID="SqldsComments2" runat="server" ConnectionString='<% session("sqlConn") %>'
SelectCommand="SELECT * FROM TicketComments Where TicketNo=@TicketNo ">
<SelectParameters>
<asp:Parameter Name="TicketNo" DefaultValue="0" Type="string" />
</SelectParameters>
</asp:SqlDataSource>

View 6 Replies View Related

Sql Insert, Capture Scope_Identity Output To Session Variable?

May 24, 2007

What C# code would capture the Scope_Identity value (CoDeptRowID) output by the code below? Do I even need to capture it or is it already available as a C# variable CoDeptRowID ? I can't seem to get my hands on it!
SqlDataSource1.Insert();<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
InsertCommand="INSERT INTO [CompanyDepartment] ([User_Name], [FirstName], [LastName]) VALUES (@User_Name, @FirstName, @LastName);
SELECT @CoDeptRowID = SCOPE_IDENTITY()"
<insertparameters>
<asp:sessionparameter Name="User_Name" Type="String" SessionField ="LoginName"/>
<asp:controlparameter Name="FirstName" Type="String" ControlID="TextBox1" PropertyName ="text"/>
<asp:controlparameter Name="LastName" Type="String" ControlID ="TextBox2" PropertyName ="text"/>
<asp:Parameter Direction =Output Name ="CoDeptRowID" Type ="Int32" DefaultValue = "0" />
</insertparameters>
</asp:SqlDataSource>

View 5 Replies View Related

SqlDataSource.Update With Session Variable As Input Parameter

May 25, 2007

I'm getting a type mismatch error (currently string, when I think I need Int32 ?) with the code below. I'm having difficultly setting my session variable to type Int32 and having it take up the value of RawCoDeptRowID. When I "Watch" it, it's value remains as "snCoDeptRowID".  Also, not sure if my Update command and it's snCoDeptRowID input parameter is well formed? Any advice would be greatly appreciated. Thank you.
Web Page 1:
Session["snCoDeptRowID"] = Convert.ToInt32 (RawCoDeptRowID);
 
Web Page2:<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
UpdateCommand="UPDATE [CompanyDepartment] SET [User_Name] = @User_Name, [FirstName] = @FirstName, [LastName] = @LastName, [Company_Name] = @Company_Name, [Department_Name] = @Department_Name WHERE [User_ID] = @snCoDeptRowID ">
<updateparameters>
<asp:parameter Name="User_Name" Type="String" />
<asp:parameter Name="FirstName" Type="String" />
<asp:parameter Name="LastName" Type="String" />
<asp:Controlparameter Name="Company_Name" Type="String" ControlID ="ListBox1" PropertyName ="SelectedValue" />
<asp:Controlparameter Name="Department_Name" Type="String" ControlID ="ListBox2" PropertyName ="SelectedValue" />
<asp:QueryStringParameter Name="User_ID" Type="Int32" QueryStringField ="@snCoDeptRowID" DefaultValue ="@snCoDeptRowID" />
</updateparameters>
</asp:SqlDataSource>

View 1 Replies View Related

Local Or Global Variable In An Interaction Session Of The SQL Analyzer

Jul 20, 2005

Hi,I am new to SQL. Please bear with me and allow me to ask a dumbquestion.I am debugging a stored procedure (written in Trans-SQL), and I foundthat the SQL analyzer that I use doesn't have a debugger. All I cando it is execute a block of code and see what is going on in aninteraction seesion of the SQL analyzer. I would need to declare somevariable to hold values of the previous query in the interactivesession.I understand that this can be easily done in a stored procedure viathe Declare command (e.g., Delcare @order_no int). Is similarfunctionality exists in an interaction session of the SQL analyzer?If so, what is the command. Please advise.Thank you very much for the help.Alex

View 1 Replies View Related

How To Write A SELECT Statement And Store The Result In A Session Variable

Nov 6, 2007

I'm sure this is a very simple piece of code, but I'm having trouble understanding how to do this.
First I have a database with three columns


ContactID

View 1 Replies View Related

SQL Server Session State - Using A 1.1 Database Schema For 2.0 Session State Storage

Aug 3, 2006

The 2.0 version of ASPSTATE is slightly different than the 1.1 version in that one table has one additional column and another table uses a different data type and size for the key. The 2.0 version also has a couple additional stored procedures.

We'd like to manage just one session state database if possible so we're trying to figure out if Microsoft supports using the new schema for 1.1 session state access (it seems to work, but our testing has been very light).

Is there any official support line on this? If not, can anyone comment on whether or not you'd expect it to work and why?

Thanks.

View 1 Replies View Related

Session

Sep 20, 2001

Hi all,

I need some solution..
When i execute a program it first deletes all datas from a
'X' table .Then fetches data from various other tables and
inserts into this 'X' table.I finally generate a report from
this 'X' table.

Now the problem is,
USER 1 : Executes the program - Datas in 'X' table got deleted and
filled up with new data.Report is getting processed.....
USER 2 : Executes the same program - Datas in the same 'X' table
getting deleted ..
So the report process of USER 1 got affected.

Solution 1 : Using IP address of local machine i solved the problem.But
i need a concrete solution for this ..something related to sessions..

CAN ANYONE HELP ??

Thanx and Regards
Prabhu

View 2 Replies View Related

Session

Feb 1, 2006

Does Session term exist in SQL Server?If yes, when it creates, how can monitor it. And where does itsinformation store?Thanks alot

View 1 Replies View Related

Return ID From SQL Into Session

Jun 5, 2008

How do you return the ID of an item to a Session in a ASP forum?
I have a MS-SQL Server 2005 database.
My table looks like this QuoteID, QuoteNumber, Date.
In SQL:
INSERT INTO table (QuoteNumber, Date) values ('123490WC1", '06/2/2008')DECLARE @ItemID INTSET @ItemID=IDENT_CURRENT('table')
What I would like to do is return @ItemID to the ASP forum; I assume Session would be the best.
After I get the @ItemID I have a Grid which I will to insert the Quote Items into.
Thanks,
marly

View 1 Replies View Related

Session Parameters

Jun 16, 2008

Hi, Can somebody tell me what's wrong with this statement or why the Session parameter is not working.
   <asp:SqlDataSource ID="datalist_SQL" runat="server"
ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString2 %>"
SelectCommand="SELECT * FROM tbl_subProduct, tbl_material, tbl_product, tbl_subCategory, tbl_topCategory, tbl_topLevelProduct WHERE [tbl_subProduct].[numProductID] = [tbl_product].[numProductID] AND [tbl_product].[numTopLevelProductID] = [tbl_topLevelProduct].[numTopLevelProductID] AND [tbl_topLevelProduct].[numSubCategoryID] = [tbl_subCategory].[numSubCategoryID] AND [tbl_subCategory].[numTopCategoryID] = [tbl_topCategory].[numTopCategoryID] AND [tbl_material].[numMaterialID] = [tbl_product].[numMaterialID] AND @fldArray ">
<SelectParameters>
<asp:SessionParameter Name="fldArray" SessionField="ids_array" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource> Many Thanks

View 10 Replies View Related

Get Data From SQL To Session

Jan 13, 2006

I'm new on ASP.NET 2.0Can anyone tell me how to get data from SQL to Session properties?
In Classic ASP, it looks very simple as below.dim connset conn = server.createobject("adodb.recordset")rssql = "select myid, mypw from mydb where myid = '"& request("myid") &"' and mypw = '"& request("mypw") &"'"set rs = conn.execute(rssql)if rs.eof = true thensession("myid") = rs("myid")session("mypw") = rs("mypw")end if
How to do the same things on ASP.NET?Many thanks!

View 6 Replies View Related

How To Find Session Id

Sep 1, 2006

How to find user session id in mssql

View 1 Replies View Related

New Session Inside SP?

Sep 16, 2004

Hi:

I want to open a new session/connection inside the execution of a stored procedure. Is this possible ?
I ask this because I need a new sesssion with its own transaction.

Thanks,
Rui Ferreira

View 6 Replies View Related

Terminal Session Name

May 9, 2006

Is there any way in stored procedure to find out a name of terminal session initiated connection to SQL Server?

Thanks for response

View 10 Replies View Related

Transactions Over Session

Oct 17, 2007

Hi guys,

I would like to manage the following:
BEGIN TRANSACTION;
SELECT * From SomeTable;
INSERT INTO SomeTable (SomeData) VALUES(12);
COMMIT TRANSACTION;

This should be easy usually. However, we need to have each row/command executed individually (using the SqlDataSource object in ASP.NET).

Is there a way how to make the transactions work over multiple executions?

Thanks,

Martin

View 4 Replies View Related

Asp.net Session Has Expired

Jul 11, 2006

Hi

I have designed reports using SQL Server Business Intelligence Development Studio tool (Sql Server reporting service). I have uploaded these reports to report manager.

I am displaying list of reports in tree view control, in my application. I am viewing report in Report Viewer control as per the report selection in tree view control, in same page. I am getting

Server Error in '/Application_name' Application or
ASP.NET session has expired error frequently while switching between various reports. Kindly provide me solution


.





Regards

Sagayaraj Rayappan

View 11 Replies View Related

New Value To A Existing Session Problems....

Jul 26, 2006

 
Ok, I am trying to teach myself asp.net and sql server. The problem I am having now is I want to update the session that already exists.  I have a global session (I think) that is UserEmployeeID, it is inputed when a user selects the select link on the search page which will redirect to an info page. I want to change the employee to a different employee, well I am updating the database well, no that is a lie it doesn’t that is another error, but anyway I try to update it to the new EmployeeID and it will not update…
 
Partial Class Assignment
    Inherits System.Web.UI.Page
 
    Protected Sub UpdateButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles UpdateButton.Click
 
        Dim empID As Integer
        Dim nbrID As Integer
        Dim equid As Integer
        Dim UpdateQuery
        Dim empequipid As SqlCommand
        Dim mySQLConnection As String = System.Configuration.ConfigurationManager.ConnectionStrings("DBConnectionString").ToString
        Dim myConnection As New SqlConnection(mySQLConnection)
        myConnection.Open()
 
        empID = CType(Session("UserEmployeeID"), Integer)
        equid = CType(Session("UserEquipID"), Integer)
 
 
        If CType(empID, Integer) = Nothing Then
            empID = (DropDownList1.SelectedValue)
            Response.Write("Insert: " & empID)
            'Response.End()
            Me.SqlDataSource1.InsertCommand = "INSERT INTO [EMPLOYEES_EQUIP] ([EquipID], [EmployeeID]) VALUES " & equid & " " & empID & ""
            Me.SqlDataSource1.InsertCommand = SqlDataSourceCommandType.Text
            Me.SqlDataSource1.Insert()
        Else
            empequipid = New SqlCommand("Select EmpEquipID From EMPLOYEES_EQUIP Where EmployeeID = " & empID & "  AND EquipID = " & equid & " ", myConnection)
            empequipid.CommandType = CommandType.Text
            nbrID = empequipid.ExecuteScalar
 
            ' Response.Write("Select EmpEquipID: " & nbrID)
 
            empID = (DropDownList1.SelectedValue)
 
            'Response.Write("<br>Update EmployeeID: " & empID)
 
            Me.SqlDataSource1.UpdateCommand = "UPDATE EMPLOYEES_EQUIP SET EmployeeID = " & empID & " WHERE EmpEquipID = " & nbrID & " "
            Me.SqlDataSource1.UpdateCommand = SqlDataSourceCommandType.Text
            Me.SqlDataSource1.Update()
 
            UpdateQuery = "UPDATE EMPLOYEES_EQUIP SET EmployeeID = " & empID & " WHERE EmpEquipID = " & nbrID & " "
            'Response.Write(UpdateQuery)
            'Response.End()
        End If
        Session("UserEployeeID") = (DropDownList1.SelectedValue)
        'Response.Write("<br>UserEmployeeID Session: " & Session("UserEmployeeID"))
 
 
        '-- Turn On Results Table
        resultstable.Visible = True
        '-- Hide Form by hiding table.
        maintable.Visible = False
        'clientSearch.Visible = False
 
    End Sub
End Class
 
I am also getting an error at Me.SqlDataSource1.Update() saying incorrect syntax near ‘0’ but there isn’t a 0??? I am confused…

View 1 Replies View Related

Storing Session In SQL Server

Oct 4, 2004

I have some C# code that iterates through the session state, serializes each object and stores the binary representation in an SQL table with an 'image' column. The problem is: it doesn't work. SQL server doesn't throw an error (at least ADO.NET doesnt propagate it); the table is just left unchanged. The SP works (I tested it with a few simple values); the MemoryStream and byte array are being populated correctly and bound to the parameter correctly.

What am I doing wrong? Anyone have a better approach? I know there is a builtin way of storing state in an SQL server, but I only need to do this once--namely, when a user is redirected from non-secure to secure pages--so I don't want to take that performance hit,


string uid = _session.SessionID;
object toSerialize;
BinaryFormatter formatter = new BinaryFormatter();
MemoryStream stream;

SqlConnection dbConn = SupportClasses.SqlUtilities.DBConn();
SqlCommand cmd;
SqlTransaction storeSession = null;
SqlParameter uidParam, keyParam, objParam;
try
{
dbConn.Open();
storeSession = dbConn.BeginTransaction();
foreach (string key in _session.Keys)
{
toSerialize = _session[ key ];
stream = new MemoryStream();
formatter.Serialize(stream, toSerialize);

cmd = new SqlCommand("store_session_object", dbConn, storeSession);
cmd.CommandType = CommandType.StoredProcedure;
uidParam = new SqlParameter("@uid", SqlDbType.VarChar);
uidParam.Value = uid;
cmd.Parameters.Add(uidParam);
keyParam = new SqlParameter("@object_key", SqlDbType.VarChar);
keyParam.Value = key;
cmd.Parameters.Add(keyParam);
objParam = new SqlParameter("@data", SqlDbType.Image);
objParam.Value = stream.ToArray();
cmd.Parameters.Add(objParam);

cmd.ExecuteNonQuery();
}
}
catch (SqlException ex)
{
SupportClasses.ErrorHandler.HandleSQLError(ex);
storeSession.Rollback();
}
catch (System.Runtime.Serialization.SerializationException exs)
{
// do something
}
finally
{
dbConn.Close();
}


For those interested, here is the code for the SP:

CREATE PROCEDURE store_session_object
@uid varchar(50),
@object_key varchar(25),
@data image
AS
INSERT INTO session_hold (uid, object_key, object)
VALUES (@uid, @object_key, @data)


[Cross-posted because issue spans several topics.]

View 2 Replies View Related

Sql Server Mail Session

Jan 18, 2002

when i start mail session
there is a message poping up as
"Error 17952:Faild to Start SQl Mail Session"

When i test From Sql Mail Configuration
i get a message "succesfully Started(and stopped)a MAPI session with this profile"

& still i cannot start the sql mail service"
i still get a error

what could case for this error

View 1 Replies View Related

Session Idle Timeout Over

Jun 18, 2001

Hi all,
We got this message on our production server event viewer for source MSDTC.

"String message: Session idle timeout over,tearing down the session"..
Even though it is marked as informational, just wanted to know what it is?..

thanks guys,
Marx

View 1 Replies View Related

ALTER SESSION Query ?

Jul 27, 2004

Hi,

What is the equivalent for below Oracle's ALTER SESSION query :

ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:mi:ss'

Thanks,
Sam

View 1 Replies View Related

Session Browser In SQL Server

Jan 30, 2008

Hey,

Does SQL Server have a session browser similar to Oracle and if so, how can I use it? I am looking to retrieve the SQL being ran when users are running particular reports from a gui tool.

Thanks

View 1 Replies View Related

Session State InProc. HELP??????

Jul 23, 2005

HiCan anyone help me with Session Management in ASP.NET. I have a webapplication with a login page and i need to retain the username afterhe logs in. This is what I have in Config FilesGlobal.asax<OBJECT RUNAT="SERVER" SCOPE="SESSION" ID="MyInfo"PROGID="Scripting.Dictionary"></OBJECT>web.config<configuration><!-- This section stores your SQL configuration as an appsettingcalledconn. You can name this setting anything you would like.--><appSettings><add key="conn"value="server=ADVAITH;database=tis;uid=sa;pwd=;" /></appSettings><!-- This section sets the authentication mode to formsauthenticationand routes all traffic to the specified page. It alsospecifies atimeout. The authorization section below denies all users notauthenticated. For testing purposes, custom errors was turnedoff.The section below allows pages to be trace enabled fordebugging--><system.web><sessionStatemode="InProc"cookieless="false"timeout="20" /><authentication mode="Forms"><forms name="MyFormsAuthentication" loginUrl="login.aspx"protection="All" timeout="720" /></authentication><authorization><deny users="?" /></authorization><customErrors mode="Off" /><trace enabled="true" requestLimit="0" pageOutput="true" /></system.web><system.web></system.web></configuration>When i assign the user name in the log in page it workssession("username") = txtUsername.TextBut if I use a new session variable or the username(session variable asdeclared in the login page, in the menu page it gives me error sayingthat Decralation is expected . Is there any files that i need to importb4 using sessions??Please help me out. My email:bramanujam@gmail.com

View 1 Replies View Related

Monitor Data Per Session - Available?

Jul 20, 2005

Hiya!I've combed the SQL Server 2000 online help but I don't see anythingakin to Sybase ASE's 'montor' views - equivalent to Oracle's V$views. The views are performance views which contain per sessioninformation such as:- SPID- number of logical read/write and physical read I/Os accumulatedthus far- CPU accumulated- Memoryetc.Does anyone know if I can snarf that data from SQL Server 2000?Thx!--Pablo Sanchez, Blueoak Database Engineeringhttp://www.blueoakdb.com

View 3 Replies View Related

Session Memory Usage

Jul 20, 2005

Hi,does someone know how much memory a user session takes on a SQLServerdatabase server? How many concurrent user sessions can a normal server(4 GB primary memory) handle, before connection pooling is needed?/Fredrik

View 2 Replies View Related

Instance , Session In SQL Express

Jul 24, 2007

Sorry but i need to know even it's very easy for all :


what is a session?

what is an instance?

if i use SQLExpress how meny people will be allowed to connect in same time to dataBase.?

is there another free DBManager, but is it better than SQLExpress?
thanks.

View 5 Replies View Related

Session Increasing Indefinitely

Aug 5, 2015

I`m using IIS7..At present, our company has come not a difference indeyo of operating the server using Classic ASP recently we met a big problem : session is increases indefinitely. 503.3 - ASP.net has a queue is full. The phrase occurs continuously. Is there any solution for check problems? or how can i see what source code page makes the problem (ex. 123.asp : session 300. 234.asp : session 4000).

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved