Displaying Data Horizontally

Feb 7, 2008

In sql server, multiple instances of data default to a row display or vertical. I need a set of data in sql2005 to view horizontally so I can us it in a crystal report. Here is my issue.
gift.HonorKey, gift.HonorName, gift.HonorId
1211 Smith 1222
1244 Owens 4155

I need for the data to read like this:
HonorKey1, HonorKey2, HonorName1, HonorName2, HonorId1, Honorid2
1211 1244 Smith Owens 1222 4155

the table name is gift_view

I would like to be able to create a view in sql analyzer, then save as an SQL View
My direct email is jackfam@comcast.net

View 3 Replies


ADVERTISEMENT

Displaying My Querry Horizontally

Feb 22, 2008

Is there a way to display my querry horizontally? 

View 2 Replies View Related

Horizontally Displaying Fields From 4 Views

Apr 1, 2014

I would like for each of the queries to have all of the selected fields shown horizontally in one table.

For example,
Commercial Created | Commercial Closed | Commercial UserId | Residential Created | Residential Closed | Residential UserId | Other Created | Other Closed | Other UserId.

Here is what I have now and it is displaying the fields as I would like them to. In the code below, each Views is acting as an individual table and then joined together to make another table when the query is executed.

WITH t1 AS (
SELECT vSalesReportProcessDetail.[RequestId]
,vSalesReportProcessDetail.Process
,vSalesReportProcessDetail.Entered
,vSalesReportProcessDetail.Closed
/*ROW_NUMBER() over (ORDER BY vSalesReportProcessDetail.[RequestId]) rn*/
FROM[Sales].[dbo].[vSalesReportProcessDetail]
WHERE Process = 'Commercial' ),

[code]....

View 1 Replies View Related

Store Data Horizontally Or Vertically?

Nov 11, 2005

My project is to automate testing of Stored Proceduresof type SELECT (at least for now).I want to create a table where each stored procedure'sinput parameter values are entered and in another tablethe expected result value(s) are entered when executedagainst a sample database containing manually enteredand verified data.My current problem is that the stored procedures' inputparameters range from none to 50 parameters (ok nowthat I think of it maybe this SP with 50 parameters is anINSERT SP; regardless let's assume I have SPs thatrequire 10-20-30+ parameters).My other problem is each stored procedures' returnedresult could fall into any of these four categories:- 1 row, 1 column- 1 row, many columns- many rows, 1 column- many rows, many columnsSo far I thought about 3 ways of storing the data:1- 1 large table with 50 columns that can hold variousnumber of input parameter values. Similar type of table forholding the output result for the four categories above.2- 1 small table holding one value per row. All kinds of joinswith other tables to indicate which SP and which column thevalue belongs to...3- 1 individual table per stored procedure, this way the numberof columns in the table would match exactly the number of inputparameters.Obviously the above 3 categories could apply both for the inputand output data.Now I'm still in research mode and I haven't decided on any choiceyet. And I know each approach has serious consequences; let's justsay they are all with some limitations.Has anyone dealt with this scenario before? This is the first time Ineed a table to hold various types of returned data.Just to give some numbers: possibly a few thousand SPs and verylikely each SP would have more than one test scenario.What would you suggest?Thank you

View 2 Replies View Related

Select Data Horizontally - Max Sequence Number May Vary

Sep 8, 2012

I have the following table:

Policy Sequence LossDate Description Amt
123 1 9-1-2012 property 100
123 2 10-1-2012 property 200
345 1 9-1-2012 property 100
345 2 10-1-2012 property 100
678 1 9-1-2012 property 100

I want to select the data as follows:

Policy LossDate1 Description1 Amt1 LossDate2 Description2 Amt2
123 9-1-2012 property 100 10-1-2012 property 200
345 9-1-2012 property 100 10-1-2012 property 100
678 9-1-2012 property 100 NULL NULL NULL

Is there a way to do this using T-SQL?

The max sequence number can vary, so far the max has been 12, but may be higher in the future.

View 2 Replies View Related

Displaying Data - Question

Aug 7, 2006

Dont laugh;
How do I create a simple sqlcommand in C# that shows data. I have the code for VB but I a missing something in the converstion. I know SQL but I dont get the simple steps of displaying data. I have got all of the Visual Basic stuff down I just need help with doing it by hand in C#.
or point my to a URL so that I can get  the code.
Thanks

View 1 Replies View Related

Displaying One Data Record

Jun 30, 2007

Hi all, this is a very basic question of diplaying a data. on my aspx page I have datasource that will return only ONE record.
  <asp:SqlDataSource ID="sdsCategoryName" runat="server" ConnectionString="<%$ ConnectionStrings:KaruselaConnectionString %>"        SelectCommand="SELECT Title FROM tbh_Categories WHERE CategoryID=@categoryID  ">        <SelectParameters>            <asp:QueryStringParameter DefaultValue="-1" Name="CategoryID" QueryStringField="id" Type="int32"/>        </SelectParameters>    </asp:SqlDataSource> 
on the server side I would like to manipulate the title of the page according to the data returned from the query:
 and on the behind code if (!this.IsPostBack && !string.IsNullOrEmpty(this.Request.QueryString["ID"]))
{
DataView dv2 = (DataView)sdsCategoryName.Select(arg);
this.Title = string.Format(this.Title, dv2.Table.Columns[0].ToString());
dv2.Dispose();
}
  of course it doesn't work. my question is this. do we really have to put the query datasource on the client side?and secondly, how can I view the recorsd I recieves from the query?Thanks for the help. 

View 1 Replies View Related

Please Help Displaying Specific Data

Mar 10, 2008

Hi I have used the create user wizard to create a registration page my table stores the user details and user id. I am also using the login wizard to create a log in page . I now want to display the details of the currently logged in user usind details view and allow them to view and edit their details. where and how do i create the session varible anh how do I wtire the sql select statement say select first name from table1 where (the userid I stored earlier in a table when the user registered ) = (this should be the currently logged in user'id). I am a novice so I would appreciate code snippets
My code in asp page for the details looks like this
 asp:DetailsView ID="DetailsView1" runat="server" DataSourceID="SqlDataSource1"
Height="50px" Width="125px">
<EditRowStyle BackColor="#CCFF99" />
<AlternatingRowStyle BackColor="#FFCCFF" />
</asp:DetailsView><asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ASPNETDBConnectionString1 %>"
SelectCommand="SELECT [FirstName], [LastName], [City], [Listing] FROM [UserDetails] WHERE ([UserId] = @UserId)">
</asp:SqlDataSource>
 
novice This shows no data when I test it. I have tried the folling in the .vb page no luck.
 Protected Sub DetailsView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView1.DataBound
Dim UserId As Integer = Me.DetailsView1.DataItem("userID")Session("_UserID") = UserId
End Sub

View 5 Replies View Related

Displaying Duplicate Data

Jun 15, 2007

Hi. Not sure which section this request needs to be put in, but i'm relatively new to SQL.

I have 1 table which contains an user_id (autonumber), user_name, and user_profile.

I have 2 other tables:
config_version (cv) and config (c)

These two tables both access the user table (us) to view the user_id (which is required).

I want to be able to view the user_names for both "cv" and "c" on a seperate page. Using the code below, i'm lost. I created what i wanted in MS Access with the use of a 2nd table (this might be easier to understand than my rant above). However, I don't want a 2nd table.

Can someone provide me with a function, or the "answer" to my problem?

Highlighted Blue - just there to fill in the front page with data (not wanted)
Highlighted Green - doesn't work, but was my first attempt

Code:
public function ShowQuotes
Dim objConn
Dim objADORS
Dim strSQL
Dim row

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = strConn
objConn.Open

Set objADORS = CreateObject("ADODB.RecordSet")
strSQL = "Select top 50 "
strSQL = strSQL & " cv.config_version_id as cvid, cv.configuration_id as cid, cv.version_number as cnum"
strSQL = strSQL & ", cv.status as cstat, cv.total_price as cprice, cv.modification_date as cmod, cv.version_description as cvrem"
strSQL = strSQL & ", c.remarks as qrem"
strSQL = strSQL & ", p.prod_description as pdesc, p.version as pvers, p.status as pstat"
strSQL = strSQL & ", cust.customer_name as custname"
strSQL = strSQL & ", us.user_nt_login as modname"
strSQL = strSQL & ", us.user_name as usname"
' strSQL = strSQL & ", cv.user_id as modname"
strSQL = strSQL & " from tbl_config_version as cv, tbl_configuration as c, tbl_product as p, tbl_user as us, tbl_customer as cust"
strSQL = strSQL & strWhere 'SETS RESULTS TO BE UNIQUE
strSQL = strSQL & " and us.user_id = c.user_id"
strSQL = strSQL & " and cv.configuration_id = c.configuration_id"
strSQL = strSQL & " and c.product_id = p.product_id"
strSQL = strSQL & " and c.customer_id = cust.customer_id"
strSQL = strSQL & strOrderBy & ";"

Image: www.mcdcs.co.uk/TT.jpg

View 1 Replies View Related

Matrix Displaying Data

Oct 1, 2007



I'm sorry if this is a stupid question, but this is my first matrix report.

I am using a stored procedure that generates the following data:

Item Color Size Qty
Shorts Tan 32 0
Shorts Tan 34 2
Shorts Tan 36 2
Shorts Tan 38 0

The matrix displays as follows:
34 36
Shorts Tan 2 2


I would like it to display as follows:

32 34 36 38
Shorts Tan 0 2 2 0

It seems that by default (I used the wizzard to create the report) that the zeros are being suppressed. How can I get them to display?

Thanks

View 7 Replies View Related

Help In Displaying Data From Cursor.

Mar 23, 2007

i m trying to display data from cursor.. but i think i m wrong wth the syntax..

i m doing tht in procedure..

i think dbms_output:put_line dsnt work in sql 2000 ..or may b a problem of Print statemnt instead.

help me out..thx in advance

View 5 Replies View Related

Display Query Results Horizontally One ID/row

Feb 6, 2003

I have a table where the ID column is a forign key as shown below:

select * from Joel_Table

IDID_Value
1One
2Two
3Three
1Four
2Five
3Six
1Seven
2Eight
3Nine
1Ten

Now, I order the result set based on the ID column:

select ID, ID_Value from Joel_Table
group by ID, ID_Value
order by ID, ID_Value

IDID_Value
1Four
1One
1Seven
1Ten
2Eight
2Five
2Two
3Nine
3Six
3Three

I want though to order the result set as one ID per row:
ID ID_Value ID_Value ID_Value ID_Value
1 Four One SevenTen
2 Eight Five Two
3 Nine Six Three

What is the best way of accomplishing this task?

Thank you much in advance -

View 2 Replies View Related

Merging Cells (horizontally) Depending On The Row

Apr 14, 2008

Is it possible to merge cells within several columns depending on the row number?

e.g.

colA colB colC colD

1 x a b c
2 y -------------------------

3 z -------------------------

for row # 2, #3, colB colC colD are merged.

View 7 Replies View Related

How To Get The Primary Keys And Display It Horizontally?

Jul 8, 2006

sample results: <MRNID=10002><VesselCode=VSL1>

wherein MRNID and VesselCode are primary keys of the table.

View 3 Replies View Related

UNION 2 Tables Horizontally, To One Table

Aug 5, 2007

Is it possible to combine the following tables:

Table1:
id
1
2
3

Table2:
licenses
3
2
1


To one table, like this:

id licenses
1 3
2 2
3 1

-There is always the same number of rows in both tables.

Thanks a lot!

View 9 Replies View Related

Displaying Data From Database In Textboxes

Jan 29, 2008

Im trying to display data from a database based on an input value. The value in the Label12.Text which is("hotmail") is the input value thats stored in the database, this value is been searched for in the strSQL.
 Dim strSQL As String = "SELECT Name FROM Jobseeker WHERE Email='" & Label12.Text & "' "
strSQL = Label5.Text
 
the code builds successfully, but Label5.Text appears blank.
 
 

View 2 Replies View Related

Arithmetic Expressions And Data Displaying

Feb 21, 2008

Hello, Im new to SQL. Im currently having a table called Daily with 5 columns. TesterNames,Activity,Hours_given,Hours_used and Delta. I have grabbed the data for the first three colums from another table called Tester. For Hours_used I supposed to get the data from another server after i get the access but mean time i just put my own data so that i can check the value of Delta. Data for Delta column should be as below.
Delta = Hours_given - Hours_used
So How do I do the codings for this expression and display it in the same table. Output I need as below:
TesterNames        Activity       Hours_given       Hours_used          Delta
abc                       A                    5                       6                     -1
def                        B                    7                       6                      1
 
I have used
INSERT INTO Daily ( TesterNames,Activity,Hours_given)
SELECT ( Tester_ID,Weekday_Day,EntityWDD)
FROM Tester
and the first 3 columns are filled with the data needed. But when I use
INSERT INTO DAILY(Delta) 
SELECT Delta = Hours_given - Hours_used FROM DAILY
The output was like below
TesterNames        Activity       Hours_given       Hours_used          Delta
abc                       A                    5                       6                    
def                        B                    7                       6                     
Null                     Null                  Null                   Null                    -1
Null                     Null                  Null                   Null                     1
Help me . thank you.

View 2 Replies View Related

Displaying SQL Server Data Properties In ASP

Jan 9, 2005

Does anyone know how to display the properties of a column / data field in ASP? Thanks!

View 6 Replies View Related

Data Not Displaying (in DataList) From SQL On GoDaddy

Apr 22, 2006

Everything works great on my development box.  I am using GoDaddy for production (ASP.Net v2, SQL 2000).
I am not receiving any errors, so I am stumped; no data from the database is displaying on the GoDaddy pages.
I updated the connection string in web.config to this:

< add name="snsb" connectionString="
Server=whsql-vXX.prod.mesaX.secureserver.net;
Database=DB_42706;
User ID=username;
Password=pw;
Trusted_Connection=False" providerName="System.Data.SqlClient" / >

But I am unsure if this is the issue??  Any insights?  This is the page I am working on: www.sugarandspicebakery.com/demo/bakery/default.aspx.  So, the page displays fine, but it should be showing data from the database.  This particular page uses a DataList with ItemTemplate.  There is definitely data in the database, and I have even ran the same exact query from the code using the Query Analayzer on GoDaddt and it returned results
I know there isn't much info to go by, but I am hoping someone has some insight since I have been trying to figure this out for days now!
Thank youJennifer

View 2 Replies View Related

How Can Avoid Displaying Data Using A Cursor ??

Oct 16, 1998

I defined a stored procedure with a cursor inside for updating data.
When I call it from an MSAccess client, it fails.
When I execute it directly in a ISQL/w windows, it doesn`t fail but it displays me the data (wich is the reason for failing from MSAccess).
Do somebody know if I could do it without displaying data in the screen ??

View 2 Replies View Related

Displaying Data From Multiple Rows On 1 Row

Aug 22, 2005

I would like to display data from one column on multiple rows in one row.

Example:

Name Pet
David Dog
Dawn Dog
Dawn Cat
Pete Mouse
Pete Cat
Pete Dog

I would like the result to do the following:

David Dog
Dawn Dog Cat
Pete Dog Cat Mouse

I will not know the row values ahead of time.

View 2 Replies View Related

Displaying Data From A Certain Date Range

Sep 15, 2004

Hey all, hopefully this question is in the right spot. I'm writing a .NET app talking to a MS SQL 2000 DB. I have two date range input boxes, and I want to display the data (probably in a dataGrid) from those 2 certain dates. How do I go about this with my SQL server??

My DB table has a date field that I would use to search for the data between those two user specified dates. Any tips, examples, etc. would be greatly appreciated!!!

View 14 Replies View Related

Displaying User Entered Data

Jun 25, 2007

I have a procedure that allows a user to enter two dates to run a query. I would like to display those dates on the generated report underneath the title. "5-01-07 to 5-31-07" How would I do this?

View 3 Replies View Related

Displaying Group Headers Even When No Data?

Mar 20, 2008

I have a table where I need to display groupings of information. If there isn't any data for a given group, I still need to include that group and say "no applicable data" or somesuch underneath it. Any way of doing this?

View 1 Replies View Related

(Urgent) Help Need In Displaying The Data In My Report....

Nov 15, 2007

Hi all.
I want to display the data from this table (data provided below in my report)
PlanId, ParticipantId, FundId, FundNames, Loans,PortfolioId, Act1, TotAct1, Act2, Totact2 etc.. Until act20, totAct20

18752 1041 Columbia Funds Trust VI: Columbia Small Cap Value Fund I; Class A Shares NULL NULL NULL BB 425.32 CT 0.00 DV 0.00 GL 17.40 TF 0.00 WD 0.00 OT 0.00 EB 442.72 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

18752 6204 Columbia Funds Series Trust: Columbia Small Cap Index Fund; Class A
Shares NULL NULL NULL BB 120.09 CT 0.00 DV 4.04 GL 2.10 TF 0.00 WD 0.00 OT 0.00 EB 126.23 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

18752 10302 Columbia Funds Series Trust: Columbia Marsico 21st Century Fund; Class A Shares NULL NULL NULL BB 119.59 CT 0.00 DV 1.69 GL 10.41 TF 0.00 WD 0.00 OT 0.00 EB 131.69 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

18752 11010 Columbia Acorn Trust: Columbia Acorn International Select; Class A Shares NULL NULL NULL BB 125.06 CT 0.00 DV 0.33 GL 8.83 TF 0.00 WD 0.00 OT 0.00 EB 134.22 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

18752 11024 Columbia Acorn Trust: Columbia Acorn International; Class A Shares NULL NULL NULL BB 126.85 CT 0.00 DV 0.77 GL 10.07 TF 0.00 WD 0.00 OT 0.00 EB 137.69 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

I will have around 10 -15 records depending on how many funds the user has... and i want my report to look like this

InvestmentName Act1 (BB) Act2(CT) Act3(DV) Act4(TF) ..Act20
FundNames TotAct1 TotAct2 TotAct3 TotAct4 .. Totact5 so the data will be displayed for each fund in different rows..


I am storing the value acroynms and what they stand for a different table and i know there are 20 acroynms and i need to the description of that acronymn to show in the heading... How can i do it...
I am trying to right a sproc for it...
Any help will be greatly appreciated... if you need more information.. pls feel free to ask

Regards
Karen

View 1 Replies View Related

Problem Displaying Data The Way I Want On A Report- Pls Help!

Jan 19, 2007

I have output from a query in the following format:

metric value

abc 1514.98

def 878.95

ghi 618.98



I need to present a series of ratios on my report based on set formulae:

eg liquidity ratio= abc/ghi*100

gearing ratio=def/ghi*100 etc

Basically I need to be able to reference both the metric and value where I want on the report.



Any ideas?





View 12 Replies View Related

SQL Server 2014 :: How To Append Rows Horizontally

Nov 4, 2015

I'm trying to append rows horizontally - I'm using the "xml path" approach

SELECT
E.[USER_NAME] As 'User Name',
(
SELECT ',' + C.[PERMISSION_NAME]
FOR XML PATH('')
) As [Associated Groups]
FROM TABLEA As A
JOIN TABLEB AS B ON A.PK_OBJ_ID = B.FK_APP_OBJECT_REF
JOIN TABLEC AS C ON C.PK_PERMISSION_ID = B.FK_PERMISSION_REF
JOIN TABLED AS D ON D.FK_PERMISSION_REF = C.PK_PERMISSION_ID
JOIN TABLEE AS E ON E.PK_PERSONNEL_ID = D.FK_PERSONNEL_REF
WHERE A.[OBJECT_NAME] = 'MyObjectName'

It's not working. I'm getting:

User nameAssociated Groups
A. SmithG1
A. SmithG2
A. SmithG3
etc...

What I'm looking for is:

User NameAssociated Groups
A. SmithG1, G2, G3
etc...

View 3 Replies View Related

Can I Freeze The Leftmost 2 Columns When Scrolling Horizontally?

Mar 26, 2007

Hello,

I have a very wide report that uses a table control. I would like to "freeze" the two leftmost columns so that they remain visible when the user is scrolling horizontally (sideways). Is this possibe?

Thanks,

BCB

View 8 Replies View Related

PIVOT To Return Dynamic Rows Horizontally

Jan 13, 2008

Hi,

I have a client with the following table structure:
ItemNumber, Name, Description

containing the following Data (example):






ItemNumber

Name

Value


6473764

SDRAM

4GB


6473764

Xeon

2300 Mhz


6473764

Video

256 MB


6473764

Bus

1300 Mhz


6473759

SDRAM

2GB


6473759

Xeon

2000 Mhz


6473759

Video

128 MB


6473759

Bus

1066 Mhz

I am trying to use PIVOT to convert this into Columns:






Item Number

SDRAM

Xeon

Video

Bus


6473764

4GB

2300 Mhz

256 MB

1300 Mhz


6473759

2 GB

2000 Mhz

128 MB

1066 Mhz

The problem is that I do not know the names of the columns before I run the query. I retrieve them based on a a list of Item Numbers:
SELECT DISTINCT Name FROM TableName WHERE ItemNumber IN (...)

What I was trying to do is the following, but I am not exactly sure what is wrong:

WITH ProductLines (ItemNumber, ItemName, ItemValue)
AS
(
SELECT ItemNumber, Name, Value FROM ProductItems WHERE ItemNumber IN (...)
)

SELECT * FROM ProductLines -- Don't know the column names
PIVOT
(

... -- Not sure what should come here
FOR ItemNumber IN (...)
)

Thanks a lot,

Aric Levin




View 3 Replies View Related

Rotate Text To Flow Vertically Instead Of Horizontally

Aug 23, 2007

Is it possible in the SSRS Report Designer to rotate a textbox to run vertically, or simply to rotate the text in a textbox ? I have only seen this done within axes lables of charts, but not text boxes.

Thanks in advance,
Kenny

View 1 Replies View Related

Displaying Data Across When Data Goes Down! Has To Be Easy!

May 3, 2007

I have a table with:Name, Qtr, AmountTom, 1, 100Bob, 1, 123Tom, 2, 234Bob, 2, 456Steve, 1, 565Steve, 2, 898I want the query to return:Name, Qtr 1 Amount, Qtr 2 AmountBob 123 456Steve 565 898Tom 100 234I can't seem to figure this out! Any help would be appreciated!!Sheila

View 2 Replies View Related

Problem Displaying Image Data From SQL Server

Apr 12, 2007

Hello,I'm having problems saving and then displaying binary data in sql server.I have a form that takes a file specified by the user and inserts this into sql server:protected void btnUploadFile_Click(object sender, EventArgs e)    {        if (theFile.PostedFile != null)        {            if (theFile.PostedFile.ContentLength > 0)            {                byte[] docBuffer = new byte[theFile.PostedFile.ContentLength];                Response.Write(theFile.PostedFile.ContentType.ToString());                if (docBuffer.Length > 0)                {                    // save to db                    DbAccess dbAccess = new DbAccess(); // my helper function for all db access etc                    try                    {                        dbAccess.BuildCommand("Incentives_SaveDocument");                        dbAccess.Parameters.Add("@docImage", SqlDbType.Image).Value = docBuffer;                        dbAccess.ExecuteNonQuery();                    }                    catch (Exception ex)                    {                        Response.Write(ex.ToString());                    }                }            }        }    }Stored proc:ALTER PROCEDURE Incentives_SaveDocument    @docImage imageASSET NOCOUNT ONINSERT INTO Table1 (theData) VALUES (@docImage)    RETURNThis appears to work fine. I store the binary data in a image column and if I query the db it shows the row as <Binary>.The problem I have is with retrieving the data and saving it to a file. The file saves OK but when I open it is contains lots of "squares" that I suppose are the binary - it doesn't show the text.The code for retrieving/displaying the doc is:protected void btnView_Click(object sender, EventArgs e)    {        DbAccess dbAccess = new DbAccess();        byte[] byteArray = null;        try        {            dbAccess.BuildCommand("Incentives_RetrieveDocument");            dbAccess.Parameters.Add("@id", SqlDbType.Int).Value = 6; // id for the doc to return            SqlDataReader reader1 = dbAccess.ReturnDataReader();            while (reader1.Read())            {                if (reader1.HasRows)                {                    byteArray = (byte[])reader1["theData"];                }            }            reader1.Close();            FileStream fs = new FileStream("file1", FileMode.CreateNew, FileAccess.Write);            fs.Write(byteArray, 0, byteArray.Length);            fs.Flush();            fs.Close();            FileInfo fileInfo = new FileInfo("file1");            HttpContext.Current.Response.Clear();            HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + fileInfo.Name);            HttpContext.Current.Response.AddHeader("Content-Length", fileInfo.Length.ToString());            HttpContext.Current.Response.ContentType = "application/msword";            HttpContext.Current.Response.WriteFile(fileInfo.FullName);            HttpContext.Current.Response.End();                    }        catch (Exception ex)        {            Response.Write(ex.ToString());        }        finally        {            dbAccess.CloseDbConnection();        }The stored proc:ALTER PROCEDURE Incentives_RetrieveDocument    @id intASSET NOCOUNT ONSELECT * FROM Table1 WHERE id = @id    RETURNI would be grateful for any advice on this - its the first time I've worked with BLOB data.ThanksSi

View 2 Replies View Related

Displaying Data In Datagrid From A Normalized Set Of Tables

Jul 23, 2007

Ok, I'm fairly new to .NET and even newer to the whole database concept.  But, don't run away yet, I'm no idiot and I shouldn't have too hard of a time understanding your responses if you're kind of enough to give them.  That being said, here's my dilemma:I'm trying to make a database of all the movies I own, the actors in them and the genre (s) they belong to. I have a set of tables that are in the 2NF (I think).  I have a movies table, an actors table, a genres table, and two tables called movies_actors and movies_genres with primary-foreign key relationships to pull it all together (e.g. movie_id 1 has two entries in movies_genres, one for Action and one for Drama). My problem arises that when execute my monster query to pull ALL the data on one movie, I get a row returned for every combination of Genres and Actors in a movie.  Example:movie_id            movie_title            comments            actor_first         actor_last            genre_name1                        Casino                  blah blah            Robert               DeNiro               Action1                        Casino                  blah blah            Robert               DeNiro               Drama1                        Casino                  blah blah            Joe                  Pesci                  Action1                        Casino                  blah blah            Joe                  Pesci                  Drama And here's the query that produced that:1 SELECT movies.movie_title, movies.comments, actors.actor_first,
2 actors.actor_last, genres.genre_name
3 FROM movies INNER JOIN movies_actors ON movies.movie_id = movies_actors.movie_id
4 INNER JOIN actors ON movies_actors.actor_id = actors.actor_id
5 INNER JOIN movies_genres ON movies_genres.movie_id = movies.movie_id
6 INNER JOIN genres ON movies_genres.genre_id = genres.genre_id
So, I want to put all the actors for one movie into the same cell in the datagrid (same with the genres) and still keep it sortable by actor or genre.  Is this possible with the .NET 2.0 datagrid?  Do I have some fundamental misunderstanding of how my tables should be structured?  Am I just really far off and acting like a n00b?

View 9 Replies View Related







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