Retrieve Data From Second Dataset
May 14, 2007The stored procedure returns 2 datasets. Is there any way to use the second dataset in SSRS2005?
View 1 RepliesThe stored procedure returns 2 datasets. Is there any way to use the second dataset in SSRS2005?
View 1 RepliesI'm trying to figure this out
I have a store procedure that return the userId if a user exists in my table, return 0 otherwise
------------------------------------------------------------------------
Create Procedure spUpdatePasswordByUserId
@userName varchar(20),
@password varchar(20)
AS
Begin
Declare @userId int
Select @userId = (Select userId from userInfo Where userName = @userName and password = @password)
if (@userId > 0)
return @userId
else
return 0
------------------------------------------------------------------
I create a function called UpdatePasswordByUserId in my dataset with the above stored procedure that returns a scalar value. When I preview the data from the table adapter in my dataset, it spits out the right value.
But when I call this UpdatepasswordByUserId from an asp.net page, it returns null/blank/0
passport.UserInfoTableAdapters oUserInfo = new UserInfoTableAdapters();
Response.Write("userId: " + oUserInfo.UpdatePasswordByUserId(txtUserName.text, txtPassword.text) );
Do you guys have any idea why?
Hi, Can anyone please help me solve this problem.
My functions works well with this stored procedure:
CREATE PROCEDURE proc_curCourseID@studentID int ASSELECT * FROM StudentCourse WHERE mark IS NULL AND studentID = @studentID AND archived IS NULLGO
But when I applied the same function to the following stored procedure
CREATE PROCEDURE proc_memberDetails@memberID int ASSELECT * FROM member WHERE id = @memberIDGO
I received this message
Exception Details: System.Data.SqlClient.SqlException: Procedure or function proc_memberDetails has too many arguments specified.Source Error:
Line 33: SqlDataAdapter sqlDA = new SqlDataAdapter();
Line 34: sqlDA.SelectCommand = sqlComm;
Line 35: sqlDA.Fill(dataSet);
Line 36:
Line 37: return dataSet;
The function I am using is returning a DataSet as below:
public DataSet ExecuteStoredProcSelect (string sqlProcedure, ArrayList paramName, ArrayList paramValue)
{
DataSet dataSet = new DataSet();
SqlConnection sqlConnect = new SqlConnection(GetDBConnectionString());
SqlCommand sqlComm = new SqlCommand (sqlProcedure, sqlConnect);
sqlComm.CommandType = CommandType.StoredProcedure;
for (int n=0; n<paramName.Count; n++)
{
sqlComm.Parameters.Add(paramName[n].ToString(),Convert.ToInt32(paramValue[n]));
}
SqlDataAdapter sqlDA = new SqlDataAdapter();
sqlDA.SelectCommand = sqlComm;
sqlDA.Fill(dataSet);
return dataSet;
}
If this is not the correct way, is there any other way to write a function to return a dataset as the result of the stored procedure?
Thanks.
I have an SSIS Package which Retreives Data using a SQL Query like below
select a.* from dbo.test a (nolock)
JOIN dbo.test1 b (nolock)
ON a.DetailsId = b.DetailsId
JOIN dbo.test c (nolock) on c.DetailsLineId = b.DetailsLineId
where convert(date,c.CpPlacedDate)>?
and convert(date,c.CpPlacedDate) < convert(date,GETDATE())
and c.PartnerCode in ('akakak07')
The CpPlacedDate DataType is Datetime. After the Successfull Execution of SSIS Package the final output results in destination is lesser than source.
The Maximum of cpplaceddate in the Destination for a particular date is '2015-06-13 23:46:08.923'
The Maximum of cpplaceddate in the Source for a particular date is '2015-06-13 23:59:14.873'
I am missing 16 records in between this time Gap.
Dear SQL Server Reporting Services gurus,
Before I begin describing our problem, let me first start off with a description of our environment and current configuration.
Background/Configuration Specs
We have SQL Server Reporting Services running on a Microsoft Windows Server 2003, Standard Edition, Service Pack 1 server. It is configured so that the Reports and ReportServer virtual directories run under a sql server domain account.
The datasets for our reports are xml datasets returned from calling a web service on a second IIS server, Microsoft Windows Server 2003, Standard Edition, Service Pack 1. The web service runs under a service account and is not set to impersonate the user. The web service contacts a database located on the same server as reporting services to retrieve the data. So, it should receive the request, login to the database it is trying to access using the service account, and return the dataset.
We are programatically accessing reports via a client application, specifying the virtual directory via the reportserver url (e.g. http:\hostname\reportserver\virtual directory path\report name).
Kerberos is enabled on both the sql box and the iis box with constrained delegation allow the sql account access to the iis box.
Problem
When I try to browse to the report from Report Manager in IE, (http:\hostname\Reports\...etc) I am able to successfully view the report.
When I try to view the report in the client app, (http:\hostname\reportserver\...etc.) the report fails.
Looking at the iis logs, it appears that in the first case, the web service is receiving the request from the sql server domain account. In the second case, it appears that the web service is receiving the request from an anonymous login.
Questions
What exactly is the difference between rendering/viewing a report via ReportManager versus programatically via ReportServer?
Is there any configuration we need to be aware of when configuring ReportServer?
Any help you can provide would be very much appreciated.
Thanks,
prettybrneyes81
i have two datasets.one dataset have old data from some other database.second dataset have original data from sql server 2005 database.both database have same field having id as a primary key.i want to transfer all the data from first dataset to new dataset retaining the previous data but if old dataset have the same id(primary key) as in the new one then that row will not transfer.
but if the id(primary key) have changed values then the fields updated with that data.how can i do that.
Good day., please help me,in a formview control, i set it in Insert Mode, so it should display info from table 1 but when i click on the insert button, it will insert it in table 2.btw, table 1 and table 2 are in the same database?? how about if they are not in the same database?how?please help me,Thanks.,SALAMAT PO.,
View 3 Replies View RelatedHey All,
I am developing a data acquistion system which monitors the amount of energy that a user consumes in different parts of a house and displays the information in real time on their computer screen. I am collecting the data through tranducers attached to the circuit breakers in the breaker box and sending the data to analog-to-digital converter channels in a MCU. I am retrieving the data from the serial port and storing it to a text file. Each line of data in the text file represents three fields which are separated by commas. I will be reading data from multiple data collection boxes so the first field is the unit number, the second fied represents the analog-to-digital converter channel number from each unit, and the third field is the data that is collected from the ATD channel. I am trying to use SSE to retrieve the data from the text file, and parse each line of data into individual columns in a databse. Then I want to be able to extract the data associated with a particular ATD channel number from the databse and display it in the appropriate text field on a windows form.
I've got the MCU programmed. I have no problem collecting the data from the serial port, and I can do the visual basic programming okay. I have absolutely no clue how to read the data into the database, continuosly read new values into the databse, and then access the stored data to update the text fields on the form. Please help if you can, I've been working on this specific problem for a couple of weeks and I'm not making any progress. Thanks.
Hey All,
I am developing a data acquistion system which monitors the amount of energy that a user consumes in different parts of a house and displays the information in real time on their computer screen. I am collecting the data through tranducers attached to the circuit breakers in the breaker box and sending the data to analog-to-digital converter channels in a MCU. I am retrieving the data from the serial port and storing it to a text file. Each line of data in the text file represents three fields which are separated by commas. I will be reading data from multiple data collection boxes so the first field is the unit number, the second fied represents the analog-to-digital converter channel number from each unit, and the third field is the data that is collected from the ATD channel. I am trying to use SSE to retrieve the data from the text file, and parse each line of data into individual columns in a databse. Then I want to be able to extract the data associated with a particular ATD channel number from the databse and display it in the appropriate text field on a windows form.
I've got the MCU programmed. I have no problem collecting the data from the serial port, and I can do the visual basic programming okay. I have absolutely no clue how to read the data into the database, continuosly read new values into the databse, and then access the stored data to update the text fields on the form. Please help if you can, I've been working on this specific problem for a couple of weeks and I'm not making any progress. Thanks.
Hi, all experts here,
I am wondering is there any way to select only a portion of a data set to train the mining model? In this case, I mean we dont need to split the dataset in advance, what I want to do is being able to select any random portion of a selected dataset to train a mining model. Any advices?
I am looking forward to hearing from you and thanks a lot in advance for your advices and help.
With best regards,
Yours sincerely,
I need to retrieve points column from my database for the specific user that is signed on and sum all of them. How can I do it using the Gridview and also code in vb for a label? Thanks.
View 4 Replies View RelatedHere is my sql procedure:
ALTER PROCEDURE dbo.SoftWareShow /* ( @parameter1 int = 5, @parameter2 datatype OUTPUT ) */ @SoftID uniqueidentifierAS SELECT [SoftID], [SoftName], [SoftJoinDate], [SoftSize], [SoftMode], [SoftRoof], [SoftHome], [SoftDemo], [SoftFirstClassID], [SoftSecondClassID], [SoftDesc], [SoftReadCount], [SoftDownCount],ltrim(rtrim([SoftUrlOne])) SoftUrlOne, ltrim(rtrim([SoftUrlTwo])) SoftUrlTwo, ltrim(rtrim([SoftUrlThree])) SoftUrlThree, ltrim(rtrim([SoftUrlFour])) SoftUrlFour FROM [SoftWare] WHERE ([SoftID] = @SoftID) RETURNwhere I retrieve data using sqldatasource, an error appear. how can do ?
Hello,
Before I ask a question, I am visually impaired and cannot read printed words only on a screen. I am 51 years old and have been coding professionally since I was 23 (yes that long). I have four apps on the market and run a small consultancy company in the UK and my SQL knowledge is scant. I have read two books on the subject and thought I had an idea on how SQL works.
I used to belong to another forum but they gave me a hard time so please go easy on me.
I developed an ADO app ages ago and remembered some of it ...
I have four tables (the following is a simplified version of the real thing)
MainTable (Contact data like name address etc. 23 fields)
Towns (Two fields TownUIN and TownName)
Counties (Two fields CountyUIN and CountyName)
Countries (Two fields CountryUIN and CountryName)
My database is normalised to 3NF and contains no duplicate or redundant data.
My problem ...
Sample data
Main:
MainUIN MainName MainTown
1000 Fred Bloggs 1
1001 Fred Smith 2
Towns:
TownUIN TownName
1 Bradford
2 Leeds
SELECT MainName,MainTown FROM Main WHERE MainUIN=1000 returns
'Fred Bloggs' 1 (the TownUIN)
I want ...
'Fred Bloggs' 'Bradford'
It was suggested I use
SELECT MainName,MainTown FROM Main,Towns WHERE MainUIN=1000 AND TownUIN=MainTown
This returned 'Fred Bloggs' 'Bradford' but was slow.
My question is what am I doing wrong?
I am using SQL Server 2005 Express with VB.Net 2005 on Vista Business and XP.
I am sorry my SQL knowledge is weak please dont get angry just tell me the basic thing that I do not know.
Hi.I have a IIS server with php3 installed. I have SQL server databaseand data stored in unicode format (nvarchar fields). In header of myphp I have the meta: <meta HTTP-EQUIV="content-type"CONTENT="text/html; charset=UTF-8">.I have the following problem:- I trie to do a query using ODBC (version 3.525.1022.0) and SQLServer odbc driver (version 200.85.1022.00). The query doesn'tretrieve information in utf format and accents and extra charactersaren't showed correctly.- I trie to di the query usin native OLE DB. I use mssql funtions andthe problem is the same.If I install php4 and I use "newCOM("ADODB.Connection",NULL,CP_UTF8);", then it works correctly.Anybody knows if its posible to retrieve data from sql-server in utf-8format using php3?I see in other postings that odbc driver only accept utf-8 in version3.7 or higher? Is it true? If is true, where I can download odbcdriver 3.7?Thank's in advance.Miki.
View 1 Replies View Relatedi need to retrieve data from a particular field of the gridview according to the selected row to stored it into session .....what i had done so far as following: Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) DetailsView1.PageIndex = GridView1.SelectedIndex Session.Add("receiverName", GridView1.??????) End Sub????? is the part i am not sure what to code.... i tried different method by seems to have problem of convertion.
View 1 Replies View RelatedOkay, I used the SQLDataSource control to get my data from the database
table. What or how do I retrieve individual data from the
sqldatasource? I want to do some string comparison and manipulation
before I display it to the browser. How can this be accomplish?
Help is appreciated.
Hi,
I have a website which is designed to search for employee information. I have the search system working which does exactly what I want to, but as an added feature I want there to be a button which, when someone clicks on it, it takes whatever the previous search was and generates a set of data in XML format which is based on the results. For example:
User searches for all entries with Forename = John; Results are listed in a gridview as per expected.
User then presses button with XML on it, and page pops up with just the XML output on it, i.e. whatever results are on the gridview but in a nested XML format
<records> <record> <Forename>John</Forename> <Surname>Smith</Surname> <Email>j.smith@blah.com</Email> <Ext>1234</Ext> <DeptList>History</DeptList> </record></records>
I have created a stored procedure which will take the parameters from the search boxes and return the above information, but I don't know if this is the best way. Here it is for those interested:
CREATE PROCEDURE ps_record_SELECT_NameSurnameEmailExtDeptasXML
@Forename varchar(50),
@Surname varchar(50),
@Email varchar(50),
@Ext varchar(4),
@DeptList varchar(50)
AS
SELECT Forename, Surname, Email, Ext, DeptList
FROM dbo.record
WHERE Forename LIKE COALESCE(@Forename,Forename) AND
Surname LIKE COALESCE(@Surname,Surname) AND
Email LIKE COALESCE(@Email,Email) AND
Ext LIKE COALESCE(@Ext,Ext) AND
DeptList LIKE COALESCE(@DeptList,DeptList)
FOR XML AUTO, ELEMENTS
If someone could be kind enough to help me out with this, I'd be really grateful.
Many thanks,
Tom
Last night I face performace problems in web site. I got like 100 000 users and site fails because of sql-connections.
Currently I'm making a new connection for every query, and my code looks like this:Public Shared Function executeQueryReturnDataset(ByVal strsql As String) As DataSet
Dim sqlConnection As New SqlConnection(Connstr)
Dim sqlCommand As New SqlCommand(strsql, sqlConnection)
Dim sqlDataSet As New DataSet
Try
sqlConnection.Open()
Dim myDataAdapter As New SqlDataAdapter
myDataAdapter.SelectCommand = sqlCommand
myDataAdapter.Fill(sqlDataSet)
Catch e As Exception
Console.Write(e.ToString())
Finally
sqlConnection.Close()
End Try
Return sqlDataSet
End Function I was wondering would it be better to save an instance from connection object to memory and use that same connection for all querys?
Background:I am using Visual Studio 2005 Standard SP1 to create an ASP.NET website that accesses an SQL 2005 database. I am using vb.net as well.I am passing an ID in a query string from one page to the next, where I retrieve it using an SQLDataSource. The data will only be one row; it is returning customer information.Problem:I need to be able to get specific fields from the SQLDataSource and populate some textboxes. Honestly, I'm not really sure where to begin. For the sake of argument, let's say that I am working with this:'My TextboxDim LastName As Textbox'My SQLDataSource (filtered by query string using the customer's ID to only get 1 customer's information at a time)SQLDataQuestion:So, how would I go about retrieving the lastname field from SQLData and inserting it into the textbox LastName?Thanks, J'Tok
View 2 Replies View RelatedDears,
I'm using FormView to insert and retrieve data from SQL Server Database 2000. I'm using stored procedure to insert and display data by using C#.
Every time I insert the data, I can't retrive it. To retrieve all the inserted data, I have to close my website, and then reopen it again.
I close the connection every time after using the stored procedures, but nothing happened.
What do you think the problem is ??
Let us suppose that there are 900 rows in One table, and that table contains neither primary key, nor Identity column.
How can I retrieve all the roows from 201 to 250?(like the middle limits)
In oracle there is a property called RowID, but is there any such item in SQL server?
I wonder how to get top 1 row per account number. Let's say I have
--snip--
IDENTITY_ID | ACCT_NUMBER
0001 | 1111-2222
1001 | 1111-2222
2002 | 2222-0000
3003 | 2222-0000
4004 | 1111-2222
--snip--
I used the SQL-Query here
Code:
SELECT * FROM BACKUP_LOG ORDER BY IDENTITY_ID DESC
[code]
Since they are in descending order by IDENTITY_ID, so I only want to get 1 distinct account number somehow.. Like this...
[code]
4004 | 1111-2222
3003 | 2222-0000
I couldn't figure it out.
Thanks...
I have a table called Questions and I need to retrieve 10 rows of data randomly each time. If I use
SELECT TOP 10 Question FROM Questions
I'll get the same questions each time when I execute the sql statement. Is there a way to get the random data? Thanks.
Hello
Is there any way in which i can retirve data using input parameters?
Here is the sample xml
<ClinicalDocument xmlns:sdtc="urn:h12-org:abcd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:h12-org:v3">
<realmCode code="US" />
<typeId extension="POCD_HD000040" root="2.16.840.1.113883.1.3" />
<templateId root="2.16.840.1.113883.10.20.22.1.1" />
<id root="226ff30f-3b1f-11e3-a969-005056bb0109" />
[code]....
how to write a sql query.
Hi, everione,
I am having a big problem, trying to create datebase.
I have 3 tables: SUPERAVATAR, MASTERAVATAR, MEGAAVATAR.
- SuperAvatars are heroes in an online role playing gaming. They have an ID, ‘superavatarID’ which contain an UNIQUE NUMBER NOT NULL PRIMARY KEY to identify them.
A wisdom – ‘trickster’,’conjuror’,’magician’, etc..
A current owner… who is the user or player of the game and has that Super Avatar– we associate the link to USERID to know the person.
SuperAvatars can be fathers or mothers of Mega Avatars.
-MegaAvatars are the children of SuperAvatars…. They also have an ID UNIQUE NUMBER NOT NULL PRIMARY KEY to indentify them.
A magic power – it can be a ‘Leader’ or ‘Sheep’…
A ‘parent’ – parent is the number identifying to know to who Super Avatar belongs.
e.g.
SUPERAVAT WISD CURRENTOWNER FATHEROF MOTHEROF
1 Thick 3 1
2 Mentally Ch. 11 3
3 Smart 9 2
4 Genius 16 4
5 Thick 19
MEGAAVATARID MAGICPOWER PARENT
1 MAGICIAN 1
2 WIZARD 3
3 SORCERER 2
4 MAGICIAN 4
-We see that MEGAAVATAR 1 has a magic power as Magician and his father is ‘1’. ‘1’ identifies the SUPERAVATAR.
We see SUPERAVATARID…. who has the number ‘1’? the first in the row… who has wisdom – thick and he belongs to the USER with ID number 3.
-We see MEGAAVATARID… we choose the number 2…. His magic power is as WIZARD… and his father is the number 3.
We see SUPERAVATARID now… we look up the SuperavatarID 3…. We can see he has a wisdom – GENIUS… who belongs to the USERID 16 and he is father of MEGAAVATAR number 2.
The list can carry on and never stop.
I have this Problems:
We create in this example 3 tables: Users, SuperAvatar, MegaAvatar
SQL
CREATE TABLE users(userID NUMBER CONSTRAINT pk_user PRIMARY KEY,email VARCHAR2(50) NOT NULL UNIQUE,password VARCHAR2(15) NOT NULL UNIQUE,subscription CHAR(8) NOT NULL CHECK (subscription IN('ACTIVE' , 'INACTIVE' ) ) );
CREATE TABLE superavatar(superavatarID NUMBER CONSTRAINT pk_superavatar PRIMARY KEY, wisdom VARCHAR2(19) NOT NULL CHECK (wisdom IN ('THICK', 'MENTALLY CHALLENGED', 'AWAKE', 'SMART', 'GENIUS')), currentOwner NUMBER NOT NULL, fatherOf NUMBER,motherOf NUMBER);
CREATE TABLE megaavatar (megaavatarID NUMBER CONSTRAINT pk_megaavatar PRIMARY KEY, magicPower VARCHAR2(12) NOT NULL CHECK (magicPower IN('TRICKSTER','CONJUROR','MAGICIAN','WIZARD','SORCERER')), parent NUMBER);
Now, the 3 tables are created…..
What happen when we try to insert values to this table?
In this case we insert to User Table some examples:
INSERT INTO users VALUES('3','john@hotmail.com','great78','ACTIVE');
INSERT INTO users VALUES('9','chrisandsandra@gmail.com','chrisandra)','ACTIVE');
Now, we insert to SuperAvatar some examples;
INSERT INTO superavatar VALUES('1','THICK','3','1','');
INSERT INTO superavatar VALUES('3','SMART','9','3','');
|
|
‘9’ is the UserID that we already insert to the User table
What’s the problem?
We have to insert manually the data from USERID to CURRENTOWNER as we didn’t match or link CURRENTOWNER from SUPERAVATAR Table to USERID from USER Table with a SQL CODE.
What happen if we have thousands of USERS that they register to this game…? We will never know to how belongs that SUPERAVATAR but if someone do it manually can spend a year.
I am trying to fix this problem …. I add in SUPERAVATAR TABLE ‘CHECK’ in currentOwner..
SQL> CREATE TABLE superavatar
(superavatarID NUMBER CONSTRAINT pk_superavatar PRIMARY KEY, wisdom VARCHAR2(19) NOT NULL CHECK (wisdom IN ('THICK', 'MENTALLY CHALLENGED', 'AWAKE', 'SMART', 'GENIUS')),
currentOwner NUMBER NOT NULL CHECK (currentOwner IN(SELECT userID FROM users)),
fatherOf NUMBER,
motherOf NUMBER);
*
ERROR:
ORA-02251: subquery not allowed here
It doesn’t work.
Please HELP, I have exam tomorrow
thank you
Desy
palli writes "how to retrieve data from two tables..."
View 2 Replies View Relatedhi there...i want to know how to get a specific data from a database and put it in a label? Like an example i have created a database that have "username", "account number"..example i want to put the account number of the username "kevin" into a text box (vs 2005)..
View 2 Replies View RelatedI have two dbs with the same table names and fields but different data. My connection is right, as well as my query.
How come that my program can't access the data from one table while the there's no problem with the another one? My recordset is empty even the record I'm searching for exists. It's rs.recordcount is -1. Is that database corrupted?
Hi, Im new to SQL 2005.
I want to know that, any way i can use to get data from different database?
i've got a problem when i try to save strings that represent html tags. when ,for example, my viewgrid retrieve the data i looked at the source file and i get for instance & lt instead of < and & quot instead of ".
i save the data as varchar in the sql database. does anyone know what i'm suppose to do?
used enteprise manager to retrieve a group of data from one of our files. We have id set and need to bring these key fields back online for application to work. Help !!!..
we tried a demo software called apexsql to assist in the restore, however this does not update the files one by one..
thank you in advance..
jrdubya
I need to retrieve data from 2 tables (I have a sp that populates each table) regardless if they have a match or not.
First table:
#JobListTable
job_date datetime,
job_number char(15),
job_phase char(15),
qty_delivered decimal(8,2)
Second table:
#EquentialJobListTable
job_date datetime,
job_number char(15),
job_phase char(15),
qty_received decimal(8,2)
There could be a match between the two tables, or a record could exist in one and not in the other. Result will be loaded into a DataSet and dataGrig
Can I use a join?