Tuesday, March 27, 2012

Bind multi-table dataset to a datagrid

I have created a SQL procedure that returns a dataset with a varying number of tables like the following example:

RepID-- PhoneUPS
---- ----
3---- 3

RepID-- PhoneUPS
---- ----
4---- 0

RepID-- PhoneUPS
---- ----
5---- 2

No more results.
(9 row(s) returned)
@.RETURN_VALUE = 0

All of the tables have the same header row, but are a seperate table. From my experience, I am not able to bind more than one table to a datagrid. Does anyone have any suggestions on how I can go about displaying this full dataset on my aspx page? I've been going in circles on this for two days, so I'm open to any suggestions :)

Cheers,
AndrewCan you create a UNION query in the stored procedure, rather then seperate resultsets?

Failing that, you can manually add each row of each resultset to the Items collection of the Datagrid.|||Thanks for the tip. I've been working on my SQL procedure trying to incorporate the UNION in the SELECT statement. I am having problems with the logic of working it in, though. Here is the original SQL procedure I've created:

/*BEGIN Procedure */

ALTER PROCEDURE Rep_Status_Array

AS

/* Build array or ID numbers to cycle through */
DECLARE RepIDs_cursor CURSOR
FOR SELECT UserID
FROM TBL_Users
WHERE (TBL_Users.DepartmentID > 0)

OPEN RepIDs_cursor
DECLARE @.userID int
FETCH NEXT FROM RepIDs_cursor INTO @.userID

/* Begin WHILE loop to collect data for each ID */
WHILE (@.@.FETCH_STATUS <> -1)
BEGIN
SELECT
RepID=@.userID,

PhoneUPS=(SELECT Count(*) FROM TBL_UpEntry WHERE (TypeID = 11) AND (SalesmanID = @.userID)),

LOTUPS=(SELECT Count(*) FROM TBL_UpEntry WHERE (TypeID = 1) AND (SalesmanID = @.userID)),

CVR=(SELECT Count(*) FROM TBL_UpEntry WHERE (TypeID = 1) AND (SalesmanID = @.userID)),

FETCH NEXT FROM RepIDs_cursor INTO @.userID
END
/* END WHILE loop */

CLOSE RepIDs_cursor
DEALLOCATE RepIDs_cursor

/* END Procedure */

The problem I'm having with this is that each time through the WHILE loop creates a new table in the dataset that is returned by the procedure. Any suggestions?|||Is it even possible to use UNION or UNION ALL within a WHILE loop?|||To the best of my knowledge, it is not possible to use the UNION statement in conjunction with a WHILE loop.

I'm going to go with Douglas' second recommendation and manually create a table within my page, adding each row one at a time.|||Another alternative:

Create a temporary table, and then INSERT all selected rows into the temp table, and then at the end of the SP,

SELECT * FROM #temp

(with any required ORDER BY).|||Thanks for the help, Douglas, much appreciated!

Andrew

Bind message to a constraint check

I'm doing a migration form Sybase to Microsoft Sql Server 2005. On my sybase
datbase, I have some check constrainst. Thos contraints are linked (sybase
procedure sp_bindmsg) with specific messages in case that those constraint
are not followed.
Idon't know and don't find something equivalent on Sql Server.
Thanks for your help!You cannot bind a user defined message to system errors (like of you want to add a row to a
referencing table if a value doesn't exists in the referenced table).
Consider requesting the feature to sqlwish@.microsoft.com.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"valerie uzan" <valerieu@.srl.co.il> wrote in message
news:ed0ffe6febd048e98407c892029b9413@.ureader.com...
> I'm doing a migration form Sybase to Microsoft Sql Server 2005. On my sybase
> datbase, I have some check constrainst. Thos contraints are linked (sybase
> procedure sp_bindmsg) with specific messages in case that those constraint
> are not followed.
> Idon't know and don't find something equivalent on Sql Server.
> Thanks for your help!

Bind message to a constraint check

I'm doing a migration form Sybase to Microsoft Sql Server 2005. On my sybase
datbase, I have some check constrainst. Thos contraints are linked (sybase
procedure sp_bindmsg) with specific messages in case that those constraint
are not followed.
Idon't know and don't find something equivalent on Sql Server.
Thanks for your help!
You cannot bind a user defined message to system errors (like of you want to add a row to a
referencing table if a value doesn't exists in the referenced table).
Consider requesting the feature to sqlwish@.microsoft.com.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"valerie uzan" <valerieu@.srl.co.il> wrote in message
news:ed0ffe6febd048e98407c892029b9413@.ureader.com. ..
> I'm doing a migration form Sybase to Microsoft Sql Server 2005. On my sybase
> datbase, I have some check constrainst. Thos contraints are linked (sybase
> procedure sp_bindmsg) with specific messages in case that those constraint
> are not followed.
> Idon't know and don't find something equivalent on Sql Server.
> Thanks for your help!

Sunday, March 25, 2012

Bind message to a constraint check

I'm doing a migration form Sybase to Microsoft Sql Server 2005. On my sybase
datbase, I have some check constrainst. Thos contraints are linked (sybase
procedure sp_bindmsg) with specific messages in case that those constraint
are not followed.
Idon't know and don't find something equivalent on Sql Server.
Thanks for your help!You cannot bind a user defined message to system errors (like of you want to
add a row to a
referencing table if a value doesn't exists in the referenced table).
Consider requesting the feature to sqlwish@.microsoft.com.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"valerie uzan" <valerieu@.srl.co.il> wrote in message
news:ed0ffe6febd048e98407c892029b9413@.ur
eader.com...
> I'm doing a migration form Sybase to Microsoft Sql Server 2005. On my syba
se
> datbase, I have some check constrainst. Thos contraints are linked (sybase
> procedure sp_bindmsg) with specific messages in case that those constraint
> are not followed.
> Idon't know and don't find something equivalent on Sql Server.
> Thanks for your help!sql

bind matrix or table to image or map

Hi
I want to create a report where data is fixed to certain areas on a map (eg
I have an image of Switzerland and regional data. The data should be
displayed ontop of certain regions of the map). When I deploy the report and
open it in Preview or with a browser, everything is moved: eg, if I scroll up
or down, the data moves but the map stays fix.
Is there a way to tie the dataobjects to the image so the data will always
stay ontop of the same point?
Thanks for any help,
SalvatoreYou can approximate this by placing the data regions in rectangles and
placing rectangles in specific areas you'd like.
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Salvatore" <Salvatore@.discussions.microsoft.com> wrote in message
news:B2DE92AB-4D79-4E6F-AB4F-A53FEA25CC9B@.microsoft.com...
> Hi
> I want to create a report where data is fixed to certain areas on a map
(eg
> I have an image of Switzerland and regional data. The data should be
> displayed ontop of certain regions of the map). When I deploy the report
and
> open it in Preview or with a browser, everything is moved: eg, if I scroll
up
> or down, the data moves but the map stays fix.
> Is there a way to tie the dataobjects to the image so the data will always
> stay ontop of the same point?
> Thanks for any help,
> Salvatore|||Hi Ravi
I have try by placing the data regions in rectangles or placing Image in
rectangles but without success
Thanks for any help,
Salvatore
"Ravi Mumulla (Microsoft)" wrote:
> You can approximate this by placing the data regions in rectangles and
> placing rectangles in specific areas you'd like.
> --
> Ravi Mumulla (Microsoft)
> SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "Salvatore" <Salvatore@.discussions.microsoft.com> wrote in message
> news:B2DE92AB-4D79-4E6F-AB4F-A53FEA25CC9B@.microsoft.com...
> > Hi
> > I want to create a report where data is fixed to certain areas on a map
> (eg
> > I have an image of Switzerland and regional data. The data should be
> > displayed ontop of certain regions of the map). When I deploy the report
> and
> > open it in Preview or with a browser, everything is moved: eg, if I scroll
> up
> > or down, the data moves but the map stays fix.
> >
> > Is there a way to tie the dataobjects to the image so the data will always
> > stay ontop of the same point?
> >
> > Thanks for any help,
> > Salvatore
>
>

Bind many tables from a single sp on many tables on a single repor

Hi,
i've a single stored procedure that return many tables from different select
queries. it is possible to bind on a single report all "recordset" on
different tables? in other words how i can "navigate" the source dataset, is
possible to refer to a kind of dataset index? ex. dsname[1], dsname[2] etc?RS does not support this. You either need multiple stored procedures or you
need to pass a parameter to the sp that says which recordset you want. Note
that either way you will have to call a stored procedure per dataset. It is
a one to one relationship.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"luspo" <luspo@.discussions.microsoft.com> wrote in message
news:CC7325EC-29A7-43F7-B857-4F0F0CFF1E67@.microsoft.com...
> Hi,
> i've a single stored procedure that return many tables from different
select
> queries. it is possible to bind on a single report all "recordset" on
> different tables? in other words how i can "navigate" the source dataset,
is
> possible to refer to a kind of dataset index? ex. dsname[1], dsname[2]
etc?

Bind Image Data to PictureBox

Hi,
I'm just starting w/ VB.NET and want to find out how to bind an image from a
field in a SQL Server database table to a PictureBox control. I am able to
get data from the database into text boxes, etc., and to navigate and query
to different records, but coming from the Access world, I'm not sure how to
get image data displayed. We want to scan a document (single page), and sav
e
it with it's related record and just be able to view it in a Windows Form.
I've tried a few things that haven't worked and would really appreciate some
help!
--
PaulJS(This problem should be posted in a .NET Group)
For the example of o picturebox you should go along like this (picturebox).
Binding myBind = myPBox.DataBindings.Add("Image", myDataTable,
myDataColumn);
myBind.Format += new ConvertEventHandler(FormatImageData);
private void FormatImageData(object sender, ConvertEventArgs e)
{
if (e.DesiredType == typeof(Image))
{
System.Byte[] bytes = e.Value as Byte[];
System.IO.MemoryStream stream
= new System.IO.MemoryStream(bytes);
System.Drawing.Image image
= System.Drawing.Image.FromStream(stream);
stream.Close();
// Re-assign formatted data
e.Value = image;
}
}
HTH, Jens Suessmeyer.