Showing posts with label images. Show all posts
Showing posts with label images. Show all posts

Sunday, March 25, 2012

Datasets, searching, complex queries.

Alright just starting out in ASP.NET and it's making my head spin, but I think I'm getting it.

My schema in brief : Images, Categories, and a table in the middle so we can have a many-to-many relationship between images and categories. My issue is searching. I can search by keyword, and limit it to categories. So, in pseudo sql..


SELECT ... WHERE keyword LIKE '%test%' and category_id in (1,5,20,66);


I made a variable for the keyword no problem. But how can I get this dynamic list? Or, is there another way about going this problem?

Where will you put your query in? StoredProcedure or Web? I think my two posts help you:

http://forums.asp.net/t/1162993.aspx

http://forums.asp.net/t/1158548.aspx

|||

I've been informed by the big shark guy that I recommend D-SQL a lot, but you are asking for it so here goes:

First off... beware SQL injection. Strip out ' and - from your search text. Do without.

CREATE PROCEDURE sp_search @.keyword varchar(50),
@.categorylist varchar(150) as

declare @.sql varchar(max)

set @.sql = 'SELECT ... WHERE keyword LIKE ''%' + @.keyword + '%'' and category_id in (' + @.categorylist + ')' -- BTW those are double single quotes, not double quotes

EXEC sp_executesql @.sql, N'@.keyword varchar(50), @.categorylist varchar(150)'

then call sp_search in your code, adding the keyword and category list strings as parameters. Does that help?

|||

che : i'll read those links now

Charles : Interesting. Will I be able to accomplish something like this with Oracle? That looks like SQL Server to me?

|||

Oh. Most folks here are SQL Server. I'm sure you can do dynamic SQL in oracle though - my boss who taught me D-SQL co-authored the Oracle Designer/2000 Handbook. The sp_executesql is a SQL serber built-in sp, and I don't know what the equivalent is in oracle:

http://lbdwww.epfl.ch/f/teaching/courses/oracle8i/server.815/a68022/dynsql.htm

|||

This is a little disappointing. Dynamic SQL seems really overkill for such a trivial problem.

Perhaps I should look at not using strongly typed Datasets? Build one on the fly? Would that be different/better?

|||

Many of the problems were have these days tend to be ones caused by the complexity of the frameworks we are working in. For example, to write a web page, I have to know C# (or VB), ASP, HTML, SQL, and .Net, and how they all interrelate. For one page. It used to be that all you needed was a front end and a database. Oh well, we get a lot in terms of scalability and functionality out of this stuff too - the complexity is market driven.

All philosophy aside, it seems to me that most searches are done with D-Sql. If you really want to make a mountain out of a molehill, you could create a search object that safely builds your query in C# and then access it from your search front end. The advantage of that would be that you could get a lot of re-use in the future. Searching is a non-trivial issue. The volume of work that has gone into searching makes it difficult to mine for simple one-off solutions.

sql

Wednesday, March 7, 2012

Data-Bound Images

I can't seem to figure out how to add data-bound images to a report when the
database only holds the url for the images, not the binary images
themselves. Do images really need to be stored in the database in order to
be data-bound? If so, I wonder if it is possible to create a sp that can
dynamically pull the image from the image-path. Any suggestions would be
appreciated. Thanks.Elmer:
I am trying to work out the exact same thing. I've posted my question here
twice and not gotten a reply.
If you happen to figure it out, I'd greatly appreciate a reply here.
"Elmer Miller" <elmermiller@.empireco.com> wrote in message
news:ObrMUxhbGHA.3352@.TK2MSFTNGP03.phx.gbl...
>I can't seem to figure out how to add data-bound images to a report when
>the database only holds the url for the images, not the binary images
>themselves. Do images really need to be stored in the database in order to
>be data-bound? If so, I wonder if it is possible to create a sp that can
>dynamically pull the image from the image-path. Any suggestions would be
>appreciated. Thanks.
>|||I ended up using SSIS to batch the images into a table. I thought about
binding the report to an SSIS package, but this solution may take me longer
to implement and may not perform as well.
"Elliot Rodriguez" <elliotrodriguezatgeemaildotcom> wrote in message
news:ukRDa9hbGHA.4672@.TK2MSFTNGP04.phx.gbl...
> Elmer:
> I am trying to work out the exact same thing. I've posted my question here
> twice and not gotten a reply.
> If you happen to figure it out, I'd greatly appreciate a reply here.
> "Elmer Miller" <elmermiller@.empireco.com> wrote in message
> news:ObrMUxhbGHA.3352@.TK2MSFTNGP03.phx.gbl...
>>I can't seem to figure out how to add data-bound images to a report when
>>the database only holds the url for the images, not the binary images
>>themselves. Do images really need to be stored in the database in order to
>>be data-bound? If so, I wonder if it is possible to create a sp that can
>>dynamically pull the image from the image-path. Any suggestions would be
>>appreciated. Thanks.
>

Databound Image to header...export issue

I followed the instructions from this post...

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=384621&SiteID=1

on how to add databound images into a report header.

The issue I am encountering is exporting to PDF. If the report spans multiple pages, in PDF the image only shows up on the first page..and broken on all other pages.

I have tied the hidden image to the table that spans multiple pages. Shows ok in HTML but breaks when exported.

Thanks for any help.How did tie the hidden image to the table? Through RepeatWith? If so, the issue here is probably that RepeatWith is not supported in PDF. You can try adding a row to the table, mark it repeat on every page, and place the hidden image in the table row to make sure it gets repeated on each page.|||

try this

u can do that with the help of parameters

1) add a calculated field in dataset named imagebase64 in that add the following expression

Convert.ToBase64String(Fields!Photo.value)

2)Add report Parameter named image

set the datatype as string.

in the default value select the dataset and value field as imagebase64(calculated field)

set allow blank-true

set prompt-image

set hidden-true|||

I am having the same issue. The page header image shows in "Preview" but when exported to PDF it does not appear on any page, IE, the "red X" appears. The image works fine when exported to Excel.

Did you ever resolve this issue?

Thanks,

John

Databound Image to header...export issue

I followed the instructions from this post...

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=384621&SiteID=1

on how to add databound images into a report header.

The issue I am encountering is exporting to PDF. If the report spans multiple pages, in PDF the image only shows up on the first page..and broken on all other pages.

I have tied the hidden image to the table that spans multiple pages. Shows ok in HTML but breaks when exported.

Thanks for any help.How did tie the hidden image to the table? Through RepeatWith? If so, the issue here is probably that RepeatWith is not supported in PDF. You can try adding a row to the table, mark it repeat on every page, and place the hidden image in the table row to make sure it gets repeated on each page.|||

try this

u can do that with the help of parameters

1) add a calculated field in dataset named imagebase64 in that add the following expression

Convert.ToBase64String(Fields!Photo.value)

2)Add report Parameter named image

set the datatype as string.

in the default value select the dataset and value field as imagebase64(calculated field)

set allow blank-true

set prompt-image

set hidden-true|||

I am having the same issue. The page header image shows in "Preview" but when exported to PDF it does not appear on any page, IE, the "red X" appears. The image works fine when exported to Excel.

Did you ever resolve this issue?

Thanks,

John

Databound Image to header...export issue

I followed the instructions from this post...

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=384621&SiteID=1

on how to add databound images into a report header.

The issue I am encountering is exporting to PDF. If the report spans multiple pages, in PDF the image only shows up on the first page..and broken on all other pages.

I have tied the hidden image to the table that spans multiple pages. Shows ok in HTML but breaks when exported.

Thanks for any help.
How did tie the hidden image to the table? Through RepeatWith? If so, the issue here is probably that RepeatWith is not supported in PDF. You can try adding a row to the table, mark it repeat on every page, and place the hidden image in the table row to make sure it gets repeated on each page.|||

try this

u can do that with the help of parameters

1) add a calculated field in dataset named imagebase64 in that add the following expression

Convert.ToBase64String(Fields!Photo.value)

2)Add report Parameter named image

set the datatype as string. in the default value select the dataset and value field as imagebase64(calculated field) set allow blank-true set prompt-image set hidden-true|||

I am having the same issue. The page header image shows in "Preview" but when exported to PDF it does not appear on any page, IE, the "red X" appears. The image works fine when exported to Excel.

Did you ever resolve this issue?

Thanks,

John