DataSource Controls :: Run A Single Select Statement And Store The Resulting Value In A Variable?

Jan 28, 2011

I need to run a select statement on log in event and store the value of the select statement (returning one item) in a session variable.Do I have to u sqldatasource for this.. or is there someway I can run a single select statement and store the resulting value in a variable?

View 7 Replies


Similar Messages:

DataSource Controls :: How To Get A Single Value Out Of A Stored Procedure Recordset And Store It In A Variable

May 19, 2010

Here's a stored procedure I created that uses another stored procedure inside it to return a value:

[Code]....

Note the 'exec dirinfo.dbo.d_searchempbyname @TicketSubName' part. That stored procedure will return a single record. What I need is to get a single column from that recordset (in this case, the email address of the employee), and store that value in a variable.

View 3 Replies

DataSource Controls :: Unable To Use Session Variable In Sql Select Statement

May 26, 2010

I am new to all this, and ignorant beyond compare. I believe I have the same problem as this :

[URL]. However, the solution proposed for him doesn't seem to work for me. I have a session variable that 'march_cpi_session' that I wish to include in an sql select statement to multiply the values I get from a datatable before they're used to populate a gridview control. The session variable works fine elsewhere in my application, but causes a variety (depending upon how I fiddle about with the syntax) of sql errors. This is the currrent code:

[code]....

View 3 Replies

Forms Data Controls :: Store Textbox(inside The Gridview) Information In Single Variable"

Oct 12, 2010

store textbox(inside the gridview) information in single variable"

View 3 Replies

DataSource Controls :: How To Pass Two Parameters In Single Statement

Sep 8, 2010

This works great for 1 parameter
SqlDataSource1.SelectParameters("City").DefaultValue = Me.Page.Title

But I can't figure out how to pass in two parameters in a single statement (See the Select Parameters Below) Two paremeters (City, and Classification) If I set the page title to say "Bismark Charters" Bismark = City & Charters = Classification
[Code]...
</SelectParameters >

View 4 Replies

ADO.NET :: How To Select From Oracle And Insert Into Ms SQL Within The Single Statement

Mar 1, 2011

I have a statement like this;

insert destinationtable(col1,col2,col3)
select col,col2,col3
from sourcetable t1
where not exists(select * from destinationtable t2 where t1.col1 = t2.col1)

I would like to insert into destinationtable which is MS SQL and the sourcetable is Oracle. Is there a way to do this?

View 1 Replies

DataSource Controls :: Using A Variable As A Parameter In A SQL Statement

Mar 25, 2010

I've done some SSIS package work in the past, but am by no means an expert.

I want to use an SSIS package to do the following:

1. Get the file name of the newest file in a windows folder (using a filename template like his: filename_ *.txt where the * part is always a date in the format of yyyy-mm-dd.

2. Use that file name in later portions of the SSIS package by reading the file and transferring data from it to a SQL table using a Data Flow task.

and use the result (which should be the name of the newest file) to open that file and pull data out of it and into a 2nd SQL table. I admit, I'm not sure how to use the dynamic result of this SELECT query as the file name in a flat file connection manager.

View 6 Replies

DataSource Controls :: How To Declare Variable From SQL Statement

Oct 21, 2010

I am rather confused as how or where to declare this variable in asp.net.

[Code]....

Whenever i put this in my sqldatasource for it is asking me to Define Parameters:

The wizard has detected one or more parameters in your SELECT statement. For each parameter in the Select Statement, choose a source for the parameter's value.

View 4 Replies

DataSource Controls :: Select Top Record From Sql Statement

Mar 17, 2010

If I run the following SQL script:

[Code]....

View 3 Replies

DataSource Controls :: How To Select Statement For Some Scenario

Apr 24, 2010

I want the select statement for the above scenario.

View 2 Replies

DataSource Controls :: INSERT SELECT Statement?

Apr 30, 2010

How would you handle an INSERT that gets some values from another table using SELECT, where you wanted some values to come from the source table record and other values to come from a different parameter source like a session value? Is this possible?

View 3 Replies

DataSource Controls :: Executing The SP Across Select Statement?

Apr 17, 2010

I need to execute the stored proc accross the parameters resulted from select statement

I have created one stored procedure which require one parameters ( username ) ..

i need to execute this SP accross the Select Statement which lists all the username

somethibng like :

Set @username = (Select usename from my table)
EXEC dbo.Duplicate_Data @username

View 7 Replies

DataSource Controls :: Select Statement Across Three Tables?

Mar 17, 2010

[Code]....

Select statement across three tables

View 15 Replies

DataSource Controls :: Select Statement Excluding TOP 10?

Jul 6, 2010

I need to create a SELECT statement for a table that excluded the TOP 10 records.

"SELECT TOP 10 field1,field2,field3 FROM AppData ORDER BY field1 DESC" returns the first 10 records from the table but I need to retrieve only from the 21st record onwards.

I simply don't know how to do it because I'm not that strong with SQL. I searched the forum for some answers but can't find a solution that I can understand.

View 4 Replies

DataSource Controls :: Select Statement To Get Order By Date?

Apr 27, 2010

i get this data from history table for a paricular ConsignmentNo.

................

i want the sql statement. 1st condition is sql statement should be order by CurrentStatusDate.

.......................

View 13 Replies

DataSource Controls :: Updating Field Using Select Statement?

Feb 24, 2010

I have a table "Table1" which has mani 3 fields ID: int,

Date1: datetime,

Date2: datetime

All fields are filled except Date2, so I want to copy the records in Date1 to Date2I tried this query, but it didn't work

[Code]....

View 3 Replies

DataSource Controls :: Select Statement By Multiple Dropdownlist

Feb 25, 2010

if I have three Dropdownlist A, B, C, how can I write a select statement to get data from sql server based on the dropdownlist selected.e.g. if user select dropdownlist A, select * from table where A = dropdownlist A but if user select dropdownlist A and C, then select statment is "select * from table where A = dropdownlist A and B = dropdownlist B or if selected A, B, C.......how can I settle so many choice.

View 2 Replies

DataSource Controls :: Return Values From Select Statement?

Feb 8, 2011

I have a select statement in a stored procedure and want to be able to retrieve the key column value (PRODUCTID)and return it as Output when Select statement is executed on input Parameter (NAME).

addition, return two further output values (COST,TOTAL).

note the grid control expects to receive all values at once! so i need to get out these values at the same instance of execution.

Select productID,COST,QUANTITY,NAME,TOTAL,DATE
FROM PRODUCTS
WHERE NAME=@NAME

View 2 Replies

DataSource Controls :: Count From Several Tables In One Select Statement

Mar 14, 2010

I am trying to count records belonging to a certain person in three different tables in a single select statement. The database looks like this:

Player
-PlayerId
-Name

Game
-GameId
-TournamentId
...

Goal
-GameId (FK->Game.GameId)
-PlayerId (FK->Player.PlayerId)
-Assist (FK->Player.PlayerId)

Card
-CardId
-GameId (FK->Game.GameId)
-PlayerId(FK->Player.PlayerId)

I want to select the number of goals, assist and cards a player has in a specific tournament. I tried with this query but then the goal and card column shows the sum of the number of rows matching the playerid in the Goal table and the Card table...For example if there is two matching rows in the goal table and three matching rows in the card table, I get 5 in both these columns in the resultset.

[Code]....

View 3 Replies

DataSource Controls :: SQL Select Statement - Values To Appear In Same Query

Feb 15, 2010

I am having difficulty selecting data from 2 tables that do no share a primary key value. For instance, I have an actual table, a forecast table, and a GLText table. I may have an actual value but not a forecast value but I need them to appear in the same Query (like the query results shown below). I can get all values to appear in each table but have been unsuccessful in getting all values from both tables.

View 5 Replies

DataSource Controls :: Display The Table Name In The Select Statement?

Feb 23, 2010

I need to display the table name in the select statement. how?

exact question:

we have common columns in two tables. we are displaying the records by using

select column_name from table_name_1 union select column_name from table_name_2

But the requirement is, we need to display the source table_name along with the data. consider a,c are present in table_1 and b,d are present in table_2. we need the output in the following way

eg: column_name table_name a table_1 b table_2 c table_1 d table_2

View 2 Replies

DataSource Controls :: Use A Stored Procedure In A Select Statement?

May 25, 2010

Just quick question, is it possible to Use a Stored Procedure which has a parameter in a select statement,, I mean something like the following

SELECT A, B

FROM Something

-- Something is the name of the Stored Procedure which take date parameter

View 2 Replies

State Management :: Store And Retrieve Multiple Values In A Single Session Variable?

Aug 24, 2010

I want to store employee name,designation and department in session variable and retrieve in another page how to do this.

View 2 Replies

DataSource Controls :: How To Add Condition In Select Statement For Datedifference Function

Mar 5, 2010

this is my select Statement.:-

Select (datediff(day,db_TargetDate,getdate())) from tbl_abc

in select statement only i wanted only those record in which datedifference is less than 5.

declaration of variable & then conditional checking is not wanted me because i wanted result is into select statement only & not using print statement.

View 11 Replies

DataSource Controls :: Select Statement Pulling Multiple Times From Same Row

Jan 5, 2010

[Code]....

I have a select statement that is supposed to be filling grid with information from an income table. It's only supposed to pull if the income is from the current fiscal year or is less than 1 year old. Currently, what it does is pull multiples of rows and also rows from past income years but only if there is a mixture. For instance, if a person has income from 2005 and 2010 what it will show is this

Income 2005
Income 2005
Income 2010
Income 2010
Income 2010

Does anyone know what I've done wrong? BTW, those results are exact, old income is shown twice, current is shown 3X

View 16 Replies







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