Showing posts with label net. Show all posts
Showing posts with label net. Show all posts

Tuesday, March 27, 2012

DISTINCT to ShortDateString, not DISTINCT to the DateTime; How?

Hello,

I have written a small asp.net application, which keeps record of the proposals coming from the branch offices of a bank in a table

CREATEd as a TABLE Proposals ( ID smallint identity(7,1), BranchID char(5), Proposal_Date datetime )

This app also calculates the total number of proposals coming from a specific branch in a given date by
SELECTing COUNT(BranchID) FROM Proposals WHEREBranchID=@.prmBranchID ANDProposal_Date=@.prmDate
and prints them in a table (my target table).

This target table has as many rows as the result of the "SELECT COUNT( DISTINCT Proposal_Date ) FROM Proposals"
and excluding the first column which displays those DISTINCT Proposal_Dates, it also has as many columns as the result of the
"SELECT DISTINCT BranchID FROM Proposals".
This target table converts the DateTime values ToShortDateString so
that we are able to see comfortably which branch office has sent how many proposals in a given day.

So far so good, and everything works fine except one thing:

Certain DateTime values in the Proposals table which are of the same day but of different hours (for ex: 11.11.2005 08:30:45 and
11.11.2005 10:45:30) cause some trouble in the target table, where "SELECT COUNT( DISTINCT Proposal_Date ) FROM Proposals" is executed, because (as you might already guess) it displays two identical dates in ShortDateString form, and this doesn't make much sense (i.e. it causes redundant rows)

What I need to do is to get a result like (in a neat fashion :)

"SELECT COUNT( DISTINCT Proposal_Date ) <<DISTINCT ONLY IN THE DAYS AND NOT IN HOURS OR MINUTES OR SECONDS>> FROM Proposals"

So, how to do it in a suitable way?

Thanks in advance.

Try this -

Select Distinct Convert(char(10), Proposal_Date, 101)

It will eliminate the time part from the selection

Regards

Ash

|||

This one will solve your problem:

SELECT

DISTINCTCONVERT(NCHAR(8), Proposal_Date, 112)AS Proposal_Date

FROM

Proposals

You can look up from Books Online for the date, convert functions to help you understand more about the date and time. If you need more help, please post again.

|||

Hello,

Yeah that was what I neeed to know, and it solved the problem.

(apparently, I'm still new to T-SQL :)

Thanks.

|||

I know your problem is resolved but try the link below for more about the SQL Server DateTime convert function codes. And if you want Short Datetime you use SmallDateTime data type it gives you DateTime less seconds because it has less resolution. Hope this helps.

http://www.sqljunkies.com/Article/6676BEAE-1967-402D-9578-9A1C7FD826E5.scuk

Wednesday, March 21, 2012

Displaying Windows Icons

Sir/Mam

I am creating a task manager functionality in c#.net 2003. I am checking only for open microsoft applications . If any microsoft application is opened ,it will display the application name for ex "Microsoft Word" in the listview control and its status "Running" . Now, I want to display the icon for Microsoft word or any other microsoft application, how should I display it in the ListView control.?

I have tried by taking it in the imagelist , because I have a class which returns the Windows Icons for these applications which are opened. But, I am unable to display it.

Please help me?

Thanks,
Shivanee.
You will want to post this in a .NET forum not a SQL Server forum.

Displaying Windows Icons

Sir/Mam

I am creating a task manager functionality in c#.net 2003. I am checking only for open microsoft applications . If any microsoft application is opened ,it will display the application name for ex "Microsoft Word" in the listview control and its status "Running" . Now, I want to display the icon for Microsoft word or any other microsoft application, how should I display it in the ListView control.?

I have tried by taking it in the imagelist , because I have a class which returns the Windows Icons for these applications which are opened. But, I am unable to display it.

Please help me?

Thanks,
Shivanee.
You will want to post this in a .NET forum not a SQL Server forum.

Displaying Updated Columns

I want to use a gridview in my asp.net app to just show changes to one field in an employee table. I have a history table trigger on all fields already for other reasons, however for this purpose i want to be able to show the user what the column said before and after the change.

I read up on the columns_updated function and it seems like it could work however It seems there would be an easier way than figuring out what the bitmask is on my 14 column table for a change on the 3rd column?

Any ideas.Okay I think I already solved this using a stored procedure joining my employee table and employee history table.sql

Sunday, March 11, 2012

Displaying Parent / Child / Grandchild data

I am working on an ASP.NET site to display information about authors and books. I'm working on the Author page right now and I'm having trouble getting it to display the data I want.

I'm trying to do everything with declarative controls and as little code-behind as possible.

I have a datasource on the main page that selects the Author data and provides this to a FormView. Inside the FormView is another datasource that takes the AuthorID as a parameter and selects the list of books, which is provided to a DataList.

Inside the DataList I display some limited Book information. I also want to display some child items of the Book (grandchildren of the author), for example other authors who contributed to that book, or alternative titles. I have tried using datasources in each DataList row with a parameter set to the BookID, and it works just great, but the response time is just not acceptable. Each datasource of possible several dozen is making its own call to the database and it's just too slow.

If I use code I can grab all the data in one operation and use relations in the DataBinding event (I believe) to select the data I want, but this is a bit cumbersome and I expect will cause trouble if I want to eventually use an ObjectDataSource.

Incidentally, on a display-only page I use the XMLDataSource and it works great, but I need read-write access on the Edit page.

Is there a good way to do what I'm trying to do?

Thanks,

Graham

Here's an alternative:

Instead of putting the books in a datalist you could put them in a gridview. Handle the row selected event of the gridview and programatically bind only the 'grandchild' details specific to the selected book.

|||

That's probably what I'll end up doing, but I'm trying to avoid code as much as possible. In code it's pretty simple to avoid many trips to the database when fetching information, at the cost of some added complexity. I'm just looking to see if there's an equivalent way to do that declaratively.

It would be nice if you could bind to a datasource, specify a data member, and also throw in some selection criteria - filter it at the bound control, not at the datasource level. That's similar to what you can do with the XMLDataSource and XPathSelect.

|||

Yeah I see what you're saying.I've never managed to getsomething like that working entirely declaratively though with asp.netcontrols. Even so, if you just do the grandchild stuff programaticallyit should only be a couple of lines of code.

You could take a look at some third party grid controls made by ComponentArt, Infragistics, Telerik etc.

Friday, March 9, 2012

Displaying image from db in crystal report

hello there

I am using VB.Net 2003 with oracle 9i. My table contains a BLOB field that contains images. I tried to create a report (crystal report that is packed with VB.Net 2003) by including the table and dragging the BLOB field onto the report. But when i try to run the report, it gives me "Failed to open a rowset" error. If i run the report without the BLOB field, the report works fine.

Any idea?!?!

Thanks in advance
AndyHow did you store the images in the table?
Sounds that some images are corrupted
Visist this site and see if you find solution
www.businessobjects.com

Wednesday, March 7, 2012

Displaying Data in Datagrid from a Normalized Set of Tables

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_name

1 Casino blah blah Robert DeNiro Action

1 Casino blah blah Robert DeNiro Drama

1 Casino blah blah Joe Pesci Action

1 Casino blah blah Joe Pesci Drama

And here's the query that produced that:

1SELECT movies.movie_title, movies.comments, actors.actor_first,2actors.actor_last, genres.genre_name3FROM moviesINNERJOIN movies_actorsON movies.movie_id = movies_actors.movie_id4INNERJOIN actorsON movies_actors.actor_id = actors.actor_id5INNERJOIN movies_genresON movies_genres.movie_id = movies.movie_id6INNERJOIN genresON 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?

Can you provide some sample data from each of the tables (preferably with INSERT scripts) and expected output so it makes it easier for us to understand what you want and what you are doing to get what you want.

|||

Hi,

Your design and query looks ok, and query works as it supposed to, but I think your goal is a little bit different from what you are getting form your query.

To make it work as you want you will need to query only movie table first retrieving titles, than your data grid should have two template fields for actors and for genres which could contain a nested databound controls inside like a repeater or dataview, and those controls should have their own datasources that would rely on separate queries. For example:

first (master) query would look like this: select movie_id, movie_title, comments from movies.

the query for list of actors: select actor_first, actor_last from actors join movies_actors on movies_actors.actor_id = actors.actor_id where movies_actors.movie_id = @.movieId (this is a parameter for binding your nested data control that I mentioned about before)

and you would have similar query for genres.

|||

Ok, here's what a few basic INSERT's would look like on each of the tables:

movies table:

INSERT INTO movies (movie_id, movie_title,year, comments)
VALUES (1,'Casino', 1995,'Pretty cool movie')

actors table:

INSERT INTO actors (actor_id, actor_first, actor_last)--I think I might actually combine actor_first and actor_last
VALUES (1,'Robert','DeNiro'), (2, 'Joe' , 'Pesci')
movies_actors
INSERT INTO movies_actors (movie_id, actor_id)
VALUES (1, 1), (1,2)
genres
INSERT INTO genres (genre_id, genre_name)
VALUES (1,'Action'), (2,'Drama')
movies_genres
INSERT INTO movies_genres (movie_id, genre_id)
VALUES (1, 1), (1,2)
 So, that's just a little, but hopefully that's enough that you see how the tables are structured? If not, let me know and I can certainly elaborate further.
I'd like the output of the table to look something like this:
movie_idmovie_titleyearcommentsactorsgenres
1 Casino1995Cool movieRobert DeNiro,Action, Drama
Joe Pesci

And, preferably, I'd still like to be able to sort by genre or actor, so if you sorted by Action this movie would still come up (i.e. you wouldn't need to sort by movies that are action AND drama).I guess if I wasn't such a stubborn person I'd have just said to hell with the normalized tables and put this all in one table (or I would have just bought software that does the same thing).

But, I know my table structure is supposed to be the way to do it ... like if I have to update the spelling of an actor's name this will cause the least trouble. (edit: yuck. Nuked the styling in the last part here somehow. Sorry.)



|||

--Prepare the tables and insert sample dataCreate table movies (movie_idint, movie_titlevarchar(100), [year]int, commentsvarchar(100))INSERT INTO movies (movie_id, movie_title, [year], comments)VALUES (1,'Casino', 1995,'Pretty cool movie') goCreate table actors (actor_idint, actor_firstvarchar(100), actor_lastvarchar(100))INSERT INTO actors (actor_id, actor_first, actor_last)Select 1,'Robert','DeNiro'unionallselect 2,'Joe' ,'Pesci' goCreate table movies_actors (movie_idint, actor_idint)INSERT INTO movies_actors (movie_id, actor_id)Select 1, 1unionallselect 1,2 gocreate table movies_genres (movie_idint, genre_idint )INSERT INTO movies_genres (movie_id, genre_id)Select 1, 1unionallselect 1,2create table genres (genre_idint, genre_namevarchar(100))INSERT INTO genres (genre_id, genre_name)Select 1,'Action'unionallSelect 2,'Drama'gocreate table movies_genres (movie_idint, genre_idint )INSERT INTO movies_genres (movie_id, genre_id)Select 1, 1unionallselect 1,2create table genres (genre_idint, genre_namevarchar(100))INSERT INTO genres (genre_id, genre_name)Select 1,'Action'unionallSelect 2,'Drama'Go--Create the required functionsCreate function dbo.fnGetActors( @.Movieidint)ReturnsVarchar(500)AsBeginDeclare @.Actorsvarchar(500)Set @.Actors =''Select @.Actors = @.Actors +', ' + (A.actor_first +' ' + A.actor_last )From movies_actors MAJOIN Actors Aon MA.actor_id = A.actor_idWHERE MA.movie_id = @.MovieidReturnRIGHT(@.Actors,LEN(@.Actors) - 1 )EndGoCreate function dbo.fnGetGenres( @.Movieidint)ReturnsVarchar(500)AsBeginDeclare @.Genresvarchar(500)Set @.genres =''Select @.genres = @.genres +', ' + genre_nameFrom movies_genres MGJOIN genres GON MG.genre_id = G.genre_idWHERE MG.movie_id = @.MovieidReturnRIGHT(@.genres,LEN(@.genres) - 1 )End--Write the queryselect M.* , Actor = dbo.fnGetActors(M.movie_id ) , Genres = dbo.fnGetGenres(M.movie_id)from movies M
|||

First off, thanks a ton for the responses guys!

Robert, I understand what you're saying. I guess I just didn't know I could make a nested control with its own datasource. Is it possible you have a link to an example of something like this? I've tried a couple searches but I think I have my terminology a little mixed up ...


NDinakar, IthinkI understand your code, but what would that output look like? Would it really put both matching actors within the same cell?

|||

Hi,

Dinakar's idea is to put everything together on the database layer and it would perform much better since you would get what you want with only one database connection.

Nesting data controls gives you more flexibility in terms of presentation and data manipulation on the web form (for example actor names could be presented as links that would point to a page showing their biography etc.), however since each control has its own datasource the select statements for actors and genres would be executed for each movie row in the gridview.

I do not have any example of nested controls, but if you send me an sql script for creating your tables I could produce a simple example - it's very easy.

|||

newmanium:

NDinakar, IthinkI understand your code, but what would that output look like? Would it really put both matching actors within the same cell?

Well, why dont you give it a try. Promise, the script will not kill your server. I spent 20 mins creating the scripts. It will take you a fraction of that to cut/paste the script and check it out.Smile

|||

I actually did envision having more control over my presentation on the web form, so perhaps the nested control would work better for me. I was hoping to have a hyperlink on every actor's name so I could click on it and execute a new query for just the movies containing that actor.

But yeah, if you could give me a simple example that would tremendous. Here's what my tables look like:

CREATETABLE`actors`(

`actor_id`INT(5)NOTNULLAUTO_INCREMENTPRIMARYKEY,
`actor_name`VARCHAR(50)NOTNULL

)ENGINE=innodb;

CREATE TABLE ' movies' (
'movie_id' INT (5) NOT NULL AUTO_INCREMENT PRIMARY KEY,
'movie_name' VARCHAR (50) NOT NULL,
'comments' TEXT NOT NULL,
'year' INT (4) NOT NULL
) ENGINE = innnodb;

CREATE TABLE 'movies_actors' (
'movie_id' INT (5) NOT NULL AUTO_INCREMENT PRIMARY KEY,
'actor_id' INT (5) NOT NULL
) ENGINE = innodb;

CREATE TABLE 'genres' (
'genre_id' INT (5) NOT NULL AUTO_INCREMENT PRIMARY KEY,
'genre_name' VARCHAR (50) NOT NULL
) ENGINE = innodb;

CREATE TABLE 'movies_genres' (
'genre_id' INT (5) NOT NULL,
'movie_id' INT (5) NOT NULL
) ENGINE = innodb;

P.S. I typed that by hand just now without a client, so I apologize if it has an error or two.

|||

And Dinakar, I will try out your script :) I'm at work right now so I can't try it out very well, but I very much appreciate your time.

Displaying data from a certain date range

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!!!Hows about...

USE Northwind
GO

-- Your text boxes
DECLARE @.x datetime, @.y datetime SELECT @.x = '1996-09-01', @.y = '1996-09-30'

SELECT OrderDate, DATEDIFF(d,@.x,OrderDate), DATEDIFF(d,OrderDate,@.y)
FROM Orders
WHERE DATEDIFF(d,@.x,OrderDate) > = 0 AND DATEDIFF(d,OrderDate,@.y) > = 0|||Okay, now whats up with this DECLARE @.x datetime, @.y datetime SELECT @.x = '1996-09-01', @.y = '1996-09-30'

What am I doing with my Date1.text and Date2.text input boxes.. sorry, I'm having trouble converting the code some.|||That's TSQL

The DECALRE and SELECT is to mimic the values in your text box...

Do you have sql server client tools installed?

Query Analyzer?

Your best bet would be to call a stored procedure...|||Yes, I have those tools installed, but I really don't know how to use them to my benefit.... :(|||Puttin this code in the Query analyzer shows the DATEDIFF in pink, and some of the code after that grey... I'm guessing something else needs to be used here?|||Hows about...

USE Northwind
GO

-- Your text boxes
DECLARE @.x datetime, @.y datetime SELECT @.x = '1996-09-01', @.y = '1996-09-30'

SELECT OrderDate, DATEDIFF(d,@.x,OrderDate), DATEDIFF(d,OrderDate,@.y)
FROM Orders
WHERE DATEDIFF(d,@.x,OrderDate) > = 0 AND DATEDIFF(d,OrderDate,@.y) > = 0

Brett, I am having a similar problem...can't seem to use datetime parameters with default values in a stored procedure.

This is the code I used. Basically, trying to default dates on the Begin and End Dates for the query...but when I run it, always get this error
'Syntax error converting datetime from character string.'

Is the problem in the default values or the datediff functions? Then is the solution to format the dates differently or use a cast/convert function?

Thanks for the help

Alex

CREATE PROCEDURE dbo.usp_TempTest
@.BeginDate DateTime = '11/1/2004',
@.EndDate DateTime = getdate

AS

SELECT dbo.vw_BasicAuditDetails_Complete.*
FROM dbo.vw_BasicAuditDetails_Complete
WHERE (DATEDIFF(d, @.BeginDate, Audit_TM) > 0)
AND (DATEDIFF(d, Audit_TM, @.EndDate) > 0)
GO|||Has anyone cut and pasted my code in to query analyzer and executed it?|||That's what I was trying to do earlier.... :confused: I'm not a pro with the analyzer though..|||Well, if you highlighted the text, and pasted it in to a QA (Query Analyzer) window, and the typed [CTRL]+E, the code would execut and give you this

OrderDate
---------------- ---- ----
1996-09-02 00:00:00.000 1 28
1996-09-03 00:00:00.000 2 27
1996-09-04 00:00:00.000 3 26
1996-09-05 00:00:00.000 4 25
1996-09-06 00:00:00.000 5 24
1996-09-09 00:00:00.000 8 21
1996-09-09 00:00:00.000 8 21
1996-09-10 00:00:00.000 9 20
1996-09-11 00:00:00.000 10 19
1996-09-12 00:00:00.000 11 18
1996-09-13 00:00:00.000 12 17
1996-09-16 00:00:00.000 15 14
1996-09-17 00:00:00.000 16 13
1996-09-18 00:00:00.000 17 12
1996-09-19 00:00:00.000 18 11
1996-09-20 00:00:00.000 19 10
1996-09-20 00:00:00.000 19 10
1996-09-23 00:00:00.000 22 7
1996-09-24 00:00:00.000 23 6
1996-09-25 00:00:00.000 24 5
1996-09-26 00:00:00.000 25 4
1996-09-27 00:00:00.000 26 3
1996-09-30 00:00:00.000 29 0

Which is the range of data from the sample database Northwinds Tables Orders...The USE Statement should have brought you there.

Isn't that what you want?|||OK Ok, thanks! It is working now in Northwind... :)

Some suggested I use a Stored Procedure for doing this...

""You'll want to create a Stored Procedure in the SQL Server and then pass it's result into a DataSet to use a the Source for your DataGrid.

Try a Stored Procedure like this, Changing table and field names appropriately:
Code:
------------------------

CREATE PROCEDURE sp_BetweenDates ( @.StartDate DATETIME, @.EndDate DATETIME ) AS SELECT * FROM YOURTABLENAMEHERE WHERE [YOURDATEFIELDNAMEHERE] Between @.StartDate And @.EndDate;GO
------------------------

Then you would just pass the two dates as parameters to the Stored Procedure.""

What do you think of something like this?|||Okay, i have contrusted this query that gives me what I want...

USE billing1SQL2
GO

SELECT Hours.Employ#, Hours.Purchord, Hours.Datewrk, Hours.Hourswrk, Hours.typewrk, Hours.formwrk, Hours.class, Hours.brate, PurchaseOrder.Descr, Employee.Lastname, Employee.Firstname, Employee.[Employ#] AS Expr1, Hours.[Ticket#], PurchaseOrder.Purchord AS Expr2 FROM Hours As Hours INNER JOIN PurchaseOrder As PurchaseOrder ON Hours.Purchord = PurchaseOrder.Purchord INNER JOIN Employee As Employee ON Hours.[Employ#] = Employee.[Employ#] WHERE Hours.Datewrk between '6/15/2004' And '6/28/2004' ORDER BY Hours.Datewrk, Employee.Lastname

I just need to figure out how to use it with VB.Net the best way. Suggestions?|||Long answer:
I would start from:
System.Data.SqlClient Namespace (help is available with VB.Net)
Then I would take a class or read a book about T-SQL
Same thing for SQL server.

Short answer:
Public Sub ReadMyData(myConnString As String)
Dim mySelectQuery As String = "SELECT OrderID, Customer FROM Orders"
Dim myConnection As New SqlConnection(myConnString)
Dim myCommand As New SqlCommand(mySelectQuery, myConnection)
myConnection.Open()
Dim myReader As SqlDataReader = myCommand.ExecuteReader()
Try
While myReader.Read()
Console.WriteLine((myReader.GetInt32(0).ToString & ", " & myReader.GetString(1)))
End While
Finally
' always call Close when done reading.
myReader.Close()
' always call Close when done reading.
myConnection.Close()
End Try
End Sub 'ReadMyData
(source: VB.Net help)

good luck!|||In your VB code, you can create your query like this

dim str1 as string

str1 = "exec sp_between_dates '" & Format(Text1.text, "mm/dd/yy") & _
"','" & Format(Text2.text, "mm/dd/yy") & "'"

Roshmi Choudhury|||Okay, thank you! soo I have this stored procedure:

CREATE PROCEDURE sp_BetweenDates (@.StartDate DATETIME, @.EndDate DATETIME)
AS
SELECT *
FROM Hours WHERE [DateWrk] Between @.StartDate And @.EndDate;
GO

..and this in VB.net...

Dim str1 As String

str1 = "exec sp_BetweenDates '" & Format(txtDate1.Text, "mm/dd/yy") & _
"','" & Format(txtDate2.Text, "mm/dd/yy") & "'"

Do I need to put my txtDates.text into a variable/string "StartDate" and "EndDate" and put that in my str call, like this... ??

str1 = "exec sp_BetweenDates '" & Format(StartDate, "mm/dd/yy")

I'm just unclear how the best way to get the actual date from my text box, to the stored procedure works...

Saturday, February 25, 2012

Displaying a RS2000 Report in a .NET 2.0 control

Hello,
I need to display a report on a winform.
The report is a RS2000 report served by a RS2000 server.
The winform is in a VB .NET 2.0 (VS 2005) project.
1) Can I use a ReportViewer control (.NET 2.0) on this winform to display
this RS2000 report?
2) Must the ReportViewer control have its own dataset even though the report
is being served?
Thank you in advance,
RichardTwo modes for control: server and local. Local requires giving the control
the rdlc file and the dataset. Server mode doesn't and is much easier to do.
BUT, the server mode works only with RS 2005.
Your best bet is to embed an IE control and use URL integration.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Richard" <Richard@.discussions.microsoft.com> wrote in message
news:214F9EC1-BFD6-43E6-AC25-42D3A2A2B6F2@.microsoft.com...
> Hello,
> I need to display a report on a winform.
> The report is a RS2000 report served by a RS2000 server.
> The winform is in a VB .NET 2.0 (VS 2005) project.
> 1) Can I use a ReportViewer control (.NET 2.0) on this winform to display
> this RS2000 report?
> 2) Must the ReportViewer control have its own dataset even though the
> report
> is being served?
> Thank you in advance,
> Richard|||Thank you. Yes, I suspected that my only option was IE control.
But using the IE control and url integration, how can the navigation links
("My Subscriptions") and tabs ("Properties | History | Subscriptions") at the
top of the report's page be disabled or removed so the user don't see them,
just the report?
Thank you in advance,
Richard
"Bruce L-C [MVP]" wrote:
> Two modes for control: server and local. Local requires giving the control
> the rdlc file and the dataset. Server mode doesn't and is much easier to do.
> BUT, the server mode works only with RS 2005.
> Your best bet is to embed an IE control and use URL integration.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Richard" <Richard@.discussions.microsoft.com> wrote in message
> news:214F9EC1-BFD6-43E6-AC25-42D3A2A2B6F2@.microsoft.com...
> > Hello,
> >
> > I need to display a report on a winform.
> > The report is a RS2000 report served by a RS2000 server.
> > The winform is in a VB .NET 2.0 (VS 2005) project.
> > 1) Can I use a ReportViewer control (.NET 2.0) on this winform to display
> > this RS2000 report?
> > 2) Must the ReportViewer control have its own dataset even though the
> > report
> > is being served?
> >
> > Thank you in advance,
> >
> > Richard
>
>|||You have control over all of that with the URL. However, being a URL the
user if they knew what they were doing could still get to those areas by
modifying the URL.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Richard" <Richard@.discussions.microsoft.com> wrote in message
news:68DB3C3D-E6F5-49FD-A217-AFCEB434C80A@.microsoft.com...
> Thank you. Yes, I suspected that my only option was IE control.
> But using the IE control and url integration, how can the navigation links
> ("My Subscriptions") and tabs ("Properties | History | Subscriptions") at
> the
> top of the report's page be disabled or removed so the user don't see
> them,
> just the report?
> Thank you in advance,
> Richard
> "Bruce L-C [MVP]" wrote:
>> Two modes for control: server and local. Local requires giving the
>> control
>> the rdlc file and the dataset. Server mode doesn't and is much easier to
>> do.
>> BUT, the server mode works only with RS 2005.
>> Your best bet is to embed an IE control and use URL integration.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "Richard" <Richard@.discussions.microsoft.com> wrote in message
>> news:214F9EC1-BFD6-43E6-AC25-42D3A2A2B6F2@.microsoft.com...
>> > Hello,
>> >
>> > I need to display a report on a winform.
>> > The report is a RS2000 report served by a RS2000 server.
>> > The winform is in a VB .NET 2.0 (VS 2005) project.
>> > 1) Can I use a ReportViewer control (.NET 2.0) on this winform to
>> > display
>> > this RS2000 report?
>> > 2) Must the ReportViewer control have its own dataset even though the
>> > report
>> > is being served?
>> >
>> > Thank you in advance,
>> >
>> > Richard
>>|||If the report server and the report are 2000, can't the 2005's ReportViewer
control display the report? Thank you.
"Bruce L-C [MVP]" wrote:
> You have control over all of that with the URL. However, being a URL the
> user if they knew what they were doing could still get to those areas by
> modifying the URL.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Richard" <Richard@.discussions.microsoft.com> wrote in message
> news:68DB3C3D-E6F5-49FD-A217-AFCEB434C80A@.microsoft.com...
> > Thank you. Yes, I suspected that my only option was IE control.
> > But using the IE control and url integration, how can the navigation links
> > ("My Subscriptions") and tabs ("Properties | History | Subscriptions") at
> > the
> > top of the report's page be disabled or removed so the user don't see
> > them,
> > just the report?
> >
> > Thank you in advance,
> >
> > Richard
> >
> > "Bruce L-C [MVP]" wrote:
> >
> >> Two modes for control: server and local. Local requires giving the
> >> control
> >> the rdlc file and the dataset. Server mode doesn't and is much easier to
> >> do.
> >> BUT, the server mode works only with RS 2005.
> >>
> >> Your best bet is to embed an IE control and use URL integration.
> >>
> >>
> >> --
> >> Bruce Loehle-Conger
> >> MVP SQL Server Reporting Services
> >>
> >> "Richard" <Richard@.discussions.microsoft.com> wrote in message
> >> news:214F9EC1-BFD6-43E6-AC25-42D3A2A2B6F2@.microsoft.com...
> >> > Hello,
> >> >
> >> > I need to display a report on a winform.
> >> > The report is a RS2000 report served by a RS2000 server.
> >> > The winform is in a VB .NET 2.0 (VS 2005) project.
> >> > 1) Can I use a ReportViewer control (.NET 2.0) on this winform to
> >> > display
> >> > this RS2000 report?
> >> > 2) Must the ReportViewer control have its own dataset even though the
> >> > report
> >> > is being served?
> >> >
> >> > Thank you in advance,
> >> >
> >> > Richard
> >>
> >>
> >>
>
>|||No, the reportviewer control only support RS 2005 reports.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Richard" <Richard@.discussions.microsoft.com> wrote in message
news:AF954A4C-BB99-4188-AD7B-3FEEC4873247@.microsoft.com...
> If the report server and the report are 2000, can't the 2005's
> ReportViewer
> control display the report? Thank you.
> "Bruce L-C [MVP]" wrote:
>> You have control over all of that with the URL. However, being a URL the
>> user if they knew what they were doing could still get to those areas by
>> modifying the URL.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "Richard" <Richard@.discussions.microsoft.com> wrote in message
>> news:68DB3C3D-E6F5-49FD-A217-AFCEB434C80A@.microsoft.com...
>> > Thank you. Yes, I suspected that my only option was IE control.
>> > But using the IE control and url integration, how can the navigation
>> > links
>> > ("My Subscriptions") and tabs ("Properties | History | Subscriptions")
>> > at
>> > the
>> > top of the report's page be disabled or removed so the user don't see
>> > them,
>> > just the report?
>> >
>> > Thank you in advance,
>> >
>> > Richard
>> >
>> > "Bruce L-C [MVP]" wrote:
>> >
>> >> Two modes for control: server and local. Local requires giving the
>> >> control
>> >> the rdlc file and the dataset. Server mode doesn't and is much easier
>> >> to
>> >> do.
>> >> BUT, the server mode works only with RS 2005.
>> >>
>> >> Your best bet is to embed an IE control and use URL integration.
>> >>
>> >>
>> >> --
>> >> Bruce Loehle-Conger
>> >> MVP SQL Server Reporting Services
>> >>
>> >> "Richard" <Richard@.discussions.microsoft.com> wrote in message
>> >> news:214F9EC1-BFD6-43E6-AC25-42D3A2A2B6F2@.microsoft.com...
>> >> > Hello,
>> >> >
>> >> > I need to display a report on a winform.
>> >> > The report is a RS2000 report served by a RS2000 server.
>> >> > The winform is in a VB .NET 2.0 (VS 2005) project.
>> >> > 1) Can I use a ReportViewer control (.NET 2.0) on this winform to
>> >> > display
>> >> > this RS2000 report?
>> >> > 2) Must the ReportViewer control have its own dataset even though
>> >> > the
>> >> > report
>> >> > is being served?
>> >> >
>> >> > Thank you in advance,
>> >> >
>> >> > Richard
>> >>
>> >>
>> >>
>>

Displaying a relational database as it is displayed in MS Access

Can this be done in ASP.Net, as it stands my database views in my ASP.Net application are just standard

Unlike the view in MS Access which shows the collapsable linked data below the data (from a different table)

Many thanks

Rich

Yes, it's possible to create a GUI similar to the one that comes with Access. It's not a trivial undertaking though. You can use CSS, javascript and Ajax to overcome the inherent limitations of html.|||If your tables/views are relatively narrow and have few rows (the table can be convenantly viewed on a screen without scrolling), then use a DataGrid or GridView, and set it to automatic columns - this will give you a read-only view of the database. Code behind can be written to allow updates, but you do need to enforce any business rules.|||Have a look at http://www.codeproject.com/cs/database/DBViewer.asp A simple database viewer to manipulate SQL Server data types (in particular: image, binary, varbinary and text).|||Also try http://www.codeproject.com/asp/ute.asp "Viewer and Editor for any table in any Database you can reach from your IIS/PWS."

Friday, February 24, 2012

Display Reports in ASP.Net 2.0

What is the best way to display a report in ASP.Net 2.0. Are there web parts
like there are in SharePoint? Or is it that ReportViewer control? I am
running SQL 2005 Reporting Services.
Thanks,
DougSYou have three options.
1. Integrate using URL integration.
2. Integrate using web services and handle the nuts and bolts yourself
3. Use the new reportviewer control that comes with VS 2005 (it does not
come with RS 2005). This control is a major improvement over the example
(which is really all the previous one was) that shipped with RS 2000. This
control uses web services internally. My suggestion is to take a long hard
look at using this control. It is far and away the best way to integrate
with your own ASP.net application (this control is a asp.net 2.0 control).
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"DougS" <doug@.nospam.com> wrote in message
news:%23J9lY8mTGHA.1672@.tk2msftngp13.phx.gbl...
> What is the best way to display a report in ASP.Net 2.0. Are there web
> parts like there are in SharePoint? Or is it that ReportViewer control? I
> am running SQL 2005 Reporting Services.
> Thanks,
> DougS
>|||Thanks much. You're right, it is much better than the old ReportViewer.
DougS
"Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
news:ONyGdyoTGHA.5972@.TK2MSFTNGP10.phx.gbl...
> You have three options.
> 1. Integrate using URL integration.
> 2. Integrate using web services and handle the nuts and bolts yourself
> 3. Use the new reportviewer control that comes with VS 2005 (it does not
> come with RS 2005). This control is a major improvement over the example
> (which is really all the previous one was) that shipped with RS 2000. This
> control uses web services internally. My suggestion is to take a long hard
> look at using this control. It is far and away the best way to integrate
> with your own ASP.net application (this control is a asp.net 2.0 control).
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "DougS" <doug@.nospam.com> wrote in message
> news:%23J9lY8mTGHA.1672@.tk2msftngp13.phx.gbl...
>> What is the best way to display a report in ASP.Net 2.0. Are there web
>> parts like there are in SharePoint? Or is it that ReportViewer control? I
>> am running SQL 2005 Reporting Services.
>> Thanks,
>> DougS
>

Friday, February 17, 2012

Display image to ASP .NET from bynary data MSSQL 2000

Hi I have image in database sql server 2000 and want to display in ASP .net page. I make the memorystream from that data and write directly to page using Response.Write([bynary stream]) but U know it only display one image and other HTML is gone.

Normaly a HTML or ASP.net page will display image using local files like this <img src=..........> but how if I want to display it from memory stream that doesn't have physically in storage ? Or should I save that binary to storage first and then reference it ?

So anyone that have solution for this problem please help me how to this thing .........Smile

Hi, Take a lok at the MSDN articles on images and bitmaps.

http://msdn2.microsoft.com/en-us/library/a343dky2.aspx

regards

smcoxon

|||

You don't understand. I'm not ask about image !

My question is how to display a binary image in memorystream to ASP.NET page via HTTP ?

I try to directly write by HttpResponse.Write( ... ) but U know it display the image only......

What I want is this image can be displayed in ASP.net page ......, I can't use <img src='.......'> ,

because it's on memory stream not in URL format or in local file in your hard drive.

|||

Hi,

smcoxon has given part of the answer but that is related to winforms. The picture box can accept the byte stream that you get from the binary datatype you stored the image in.

For aspx pages.

You have to first create a page which just serves the images.

so your image tag would be

<img src="http://pics.10026.com/?src=YourImageServingPage.aspx?imageID=1" ...

On YourImageServingPage.aspx

You would remove all mark up and then add this to your code behind

Response.Clear();
Response.ContentType="image/jpeg"; or any image type you are serving.

You would create a BitMap class load your bytes from database and write the image to the Response.Write stream.

You would find many articles on this Search Key: dynamic image generation

Happy programming,
Anton

Tuesday, February 14, 2012

Display data without binding

Hi All

I am new to VS 2005 and ASP.NET. I used to use Dreamweaver to design but now I am trying VS.

What I want to do is to display data retrieved with a SqlDataSource in a web page. I know how to do it by binding it to the various controls (Grid, DataList, DetailsView, FormView, Repeater.) available but how can I display it without using any of the mentioned (Grid, DataList, DetailsView, FormView, Repeater)?

Any help apprecited.

Cheers

you can create a dataset or datatable and loop through it, then write the content of datatable and dataset on the page.