Showing posts with label service. Show all posts
Showing posts with label service. Show all posts

Friday, March 23, 2012

read image from Sql Server

Hello!

My real problem is that i want to read an image from an Sql Server DB, resize them and send them, all this through a Web Service. I decide to split my problem in four steps:

1 - read image from Database

2 - Resize that image

3 - Send her back to the DB

4 - Send the image throw a web service after he use a dataset to read the data from the DB.

i try to read the database with this function

Code Snippet

public System.Drawing.Image ReadImgFromDB(Int64 imageID)

{

System.Drawing.Image image = null;

using (SqlConnection conn = new SqlConnection())

{

string connString = WebConfigurationManager.ConnectionStrings

["StringCC"].ConnectionString;

conn.ConnectionString = connString;

SqlCommand myCommand = new SqlCommand(

"SELECT Pic FROM Images WHERE ID='"+ imageID +"'", conn);

conn.Open();

byte[] imageData = (byte[])myCommand.ExecuteScalar();

System.IO.MemoryStream memStream = new System.IO.MemoryStream(imageData);

image = System.Drawing.Image.FromStream(memStream);

}

return image;

}

i introduce a valid image ID and i get this message

" System.ArgumentException: Parameter is not valid.
at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData)
at System.Drawing.Image.FromStream(Stream stream)
at Service.ReadImgFromDB(Int64 chaveI) in e:\Web Projects\WSservice\App_Code\Service.cs:line 48"--

line 48: "image = System.Drawing.Image.FromStream(memStream);"

Thank you!

Seems like the image is corrupt, the code looks ok, though you should use parametrized queries: This will prevent SQL injection

Code Snippet

SqlCommand myCommand = new SqlCommand("SELECT Pic FROM Images WHERE ID= @.imageID", conn);

SqlParameter paramImage = new SqlParameter(@.imageID, SqlType.Varchar,20); // Depends on your parameter type

paramImage.Value = imageID;

myCommand.Parameters.Add(paramImage);

Jens K. Suessmeyer

http://www.sqlserver2005.de

|||

thank you for your reply.

Yes i usually use parameters, but for now i'm just "playing" with code.

I didn't check the images, i just assume that they're ok. i'll check them.

Thanks!

sql

Tuesday, March 20, 2012

Re SQL Resolution Service

Hi,
I am a novice to SQL Server. I work in the area of network security. In my s
tudy of the SQL Slammer/Sapphire worm, I came across SQL Resolution Service
which listens on UDP Port 1434. It seems that this service is used by client
s to get the list of named
instances, to exchange keep-alive messages, and for opening a registry key (
the slammer worm cause). I would like to know what are its other uses and ot
her acceptable commands by the service. After my futile search on MSDN I am
posting a message here.
Any pointers or links regarding this are more than welcome.
Thanks in advance,
Bhagya
Posted using Wimdows.net NntpNews Component -
Post Made from http://www.SqlJunkies.com/newsgroups Our newsgroup engine sup
ports Post Alerts, Ratings, and Searching.SQL Resolution Service on UDP 1434 is only used to support
multi-instances. It's not used with SQL Server 7 as that
version doesn't support named instances. It's not used by
the SQL Server instance or directly by clients to connect to
SQL Server. It's just to enumerate the instances on a server
and find the listening port for the specific instance.
If you try to connect to YourServer\YourNamedInstance and
that's what you specify for the connection, it hits UDP 1434
to use the SQL Server Resolution Service to find what port
number YourServer\YourNamedInstance is listening on. You can
bypass that by specifying the port yourself and then there
is no need to go through UDP 1434.
-Sue
On Wed, 28 Jul 2004 01:08:02 -0700, SqlJunkies User
<User@.-NOSPAM-SqlJunkies.com> wrote:

>Hi,
>I am a novice to SQL Server. I work in the area of network security. In my study of
the SQL Slammer/Sapphire worm, I came across SQL Resolution Service which listens o
n UDP Port 1434. It seems that this service is used by clients to get the list of na
med
instances, to exchange keep-alive messages, and for opening a registry key (the slammer worm
cause). I would like to know what are its other uses and other acceptable commands by the s
ervice. After my futile search on MSDN I am posting a message here.
>Any pointers or links regarding this are more than welcome.
>Thanks in advance,
>Bhagya
>--
>Posted using Wimdows.net NntpNews Component -
>Post Made from http://www.SqlJunkies.com/newsgroups Our newsgroup engine supports P
ost Alerts, Ratings, and Searching.|||I am looking for what are the uses of the resolution service which
runs on UDP 1434 and what commands it takes. I want to look at how did
the slammer worm succeed in triggering the vulnerability. From my
search on the Internet it seems that a command can be sent that starts
with '0x04' followed by some string, which results in opening a
registry entry on the server. What is the purpose of this command? Is
it for creating new named intances? If so, why would you allow anybody
to create new named instance on the server without any authentication?
any thoughts or ideas?
Thanks,
Bhagya
Sue Hoegemeier <Sue_H@.nomail.please> wrote in message news:<tg4fg0tm3lodstc7d5cllmj6g5guhh21
pt@.4ax.com>...[vbcol=seagreen]
> SQL Resolution Service on UDP 1434 is only used to support
> multi-instances. It's not used with SQL Server 7 as that
> version doesn't support named instances. It's not used by
> the SQL Server instance or directly by clients to connect to
> SQL Server. It's just to enumerate the instances on a server
> and find the listening port for the specific instance.
> If you try to connect to YourServer\YourNamedInstance and
> that's what you specify for the connection, it hits UDP 1434
> to use the SQL Server Resolution Service to find what port
> number YourServer\YourNamedInstance is listening on. You can
> bypass that by specifying the port yourself and then there
> is no need to go through UDP 1434.
> -Sue
> On Wed, 28 Jul 2004 01:08:02 -0700, SqlJunkies User
> <User@.-NOSPAM-SqlJunkies.com> wrote:
>
security. In my study of the SQL Slammer/Sapphire worm, I came across
SQL Resolution Service which listens on UDP Port 1434. It seems that
this service is used by clients to get the list of named instances, to
exchange keep-alive messages, and for opening a registry key (the
slammer worm cause). I would like to know what are its other uses and
other acceptable commands by the service. After my futile search on
MSDN I am posting a message here.[vbcol=seagreen]|||The internals of the Listener service are not available. Documentation on
the how the Listener service works with SQL
is included in SQL Books Online.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.

Monday, March 12, 2012

RDLC Reporting Service - setting up query parameters - is this possible?

Hi, I have my RDLC report, called on a ReportViewer, which receives a parameter (id of a column to filter the data), and the report receives this parameter very well, however, I want to use the value of this parameter to a query parameter of the dataset. On VS2005 we can asociate data sets to a report, but not a report parameter to a query parameter...is there any way to make this work?

I've heard that this is not possible using client report and report viewer, as print button. If I use a server report, will I have the print button on my application available?If not, how can I present the report with the print button available?

Thanks a lot!

You must use a server report to use reporting services built in print functionality.

For the parameters, you can programaticallly declare an array of parameters and pass them to the report. The report has a parameter section in the report properties where you can map the parameters. Alternatively, you can use any "parameters" in the creation of your datasets and not pass any parameters to the report.

|||

dr_99:

You must use a server report to use reporting services built in print functionality.

For the parameters, you can programaticallly declare an array of parameters and pass them to the report. The report has a parameter section in the report properties where you can map the parameters. Alternatively, you can use any "parameters" in the creation of your datasets and not pass any parameters to the report.

Yes I'm sure about that, thanks a lot!Only one problem, on IE the print button appears, but on Firefox does not appear, has anyone ideia what can cause this?It is set to visible!Thanks!

Friday, March 9, 2012

RDL generation problem

Hi,

I am working with SQL Server 2005 Reporting Service from few days, though I am

not expert, for some reason I have to run on field without having sound

knowledge of RDL, but need your help, gys. I am using SQL Server Business

Intelligence Development Studio to design report.

Here is the procedure of my work to populate a RDL report

    I used a stored procedure for the DataSet of my RDL

    Then I drag and drop necessary field to my report layout.

    Put required parameters to preview tab and then run report.

This is quite simple, I didn't face any problem with this process, even though

the process may not correct, but working perfect. My problem is

when the stored procedure returns multiple result set. The data tab only

shows the first result set though the SP returns multiple result set, I have

run the SP in the Query Analyzer. I don't want change my stored procedure.

And please give me some suggestions about the best procedure

to develop RDL report in real life.

Please reply me ASAP, it’s very urgent.

Thank youTareqe

Hi there,

SQL RS doesn't support multiple resultsets. You will need to either write a wrapper stored procedure to retrieve the dataset you want or modify your stored procedure.

regards,

Andrew