Showing posts with label picture. Show all posts
Showing posts with label picture. Show all posts

Thursday, March 22, 2012

Binary Data Type

Hello Dears,

I was Maked Pictures table in sql server 2005 with Two Col pic_Id (int) and picture(binary)

i need now ro insert image into this table by Asp.net under VB.net Code i have in my form FileUpload and button control

and this is my Code

ProtectedSub btnLoad_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles btnLoad.Click

Dim content()AsByte = ReadBitmap2ByteArray(FileUpload1.PostedFile.ContentType)

StoreBlob2DataBase(content)

EndSub

Function ReadBitmap2ByteArray(ByVal FileNameAsString)AsByte()

Dim imageAs Drawing.Bitmap =New Drawing.Bitmap(FileName)

Dim streamAs IO.MemoryStream =New IO.MemoryStream()

image.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp)

Return stream.ToArray

EndFunction

Sub StoreBlob2DataBase(ByVal contentAsByte())

con.Open()

Dim cmAsNew SqlCommand("Insert into Pictures(Pic_Id,picture) values(@.id,@.pic)", con)

cm.Parameters.AddWithValue("@.ID", 1)

Dim p1AsNew SqlParameter

p1.ParameterName ="@.pic"

p1.SqlDbType = Data.SqlDbType.Binary

p1.Value = content

p1.Size = content.Length

cm.Parameters.Add(p1)

cm.ExecuteNonQuery()

EndSub

when i make run to my website it give me an Exeption in this statement

Dim imageAs Drawing.Bitmap =New Drawing.Bitmap(FileName)

it tell me that Parameter is not valid

i need help about this please

with my Best regard

khalil

In this line:

Dim content()AsByte = ReadBitmap2ByteArray(FileUpload1.PostedFile.ContentType)

You are passing in the contentType rather than a filename.

|||

HI

its does not work also its give me the same error what can i do

|||

Of course it gives you the same error, I didn't fix it, I just pointed out what was wrong. Pass in the filename of the file, not the contenttype.

Tuesday, March 20, 2012

Big picture question about Reporting Services

I am an beginner who has completed one report under RS. I'm wondering if my
memory is playing tricks on me. This report has been rather easy to do.
I've hardly had to look at the documentation. (I should point out that I'm
temporarily using the SQL Express version because Someone misplaced the disks
for the full version.)
My question is this: I was under the impression that Reporting Services
involved actual Dot Net programming. At least that was the impression I got
from the early demos I saw, but it has been a while. Is there more to RS
than just dragging fields on a designer?On May 15, 8:51 am, B. Chernick <BChern...@.discussions.microsoft.com>
wrote:
> I am an beginner who has completed one report under RS. I'm wondering if my
> memory is playing tricks on me. This report has been rather easy to do.
> I've hardly had to look at the documentation. (I should point out that I'm
> temporarily using the SQL Express version because Someone misplaced the disks
> for the full version.)
> My question is this: I was under the impression that Reporting Services
> involved actual Dot Net programming. At least that was the impression I got
> from the early demos I saw, but it has been a while. Is there more to RS
> than just dragging fields on a designer?
There does not have to be any actual programming, even though you are
in Visual Studio. Demos or classes may have examples where you could
code an assembly and then call it from the report.|||You can write expressions in reporting services using visual basic.
No .net programming is required to create reports.
However, because the report definiton files (RDL) are basically xml files
then the system is wide open for customisation.
For example, I have a SQL stored procedure that generates hundreds of
reports automatically for me.
Now that is real power.sql

Big Picture Advice please to a SQL 2000 intermediate/beginner user

I am migrating a Mid-Frame DB to SQL Server 2000 PC.
I will call oldDB, OldTables the ones that belong to the Mid-Frame.
I will call newDB, newTables the ones that belong to the PC.
The oldDB has many versions and I have retrieved the oldTables to CSV
Files and then I use DTS to make a oldTables as tempTables in SQL 2000
PC.
I need to transform data and process the columns in tempTables to
create the NewTables (ie Final Tables).
I have used SQL scripts with UDFs to accomplish one run for one
version of OldDB to newDB.
The question is : Should I use ADO.NET or embedded SQL to process the
TemPTables
And CSV Files or Should stick with SQL SELECT, INSERT, UPDATE scripts
to do this ?
I have used SQL scripts with a dozen UDFs, is it time to start using
other tools /objects like SPs ?
GigaThanksInAdvanceGiga,
IMHO, if it works for you the way you're doing it, then I reckon stick with
it until you're comfortable moving to other features of SQL like stored
procs.
ADO.NET or SQL to me makes no diff if the end result is the same. You might
find things process quicker with native SQL commands. And there's not much
difference between scripts which run your UDFs or SPs to run them. Scripts
you run in QA will give you more of a visual on what's going on.
cheers
Danny
<placidite1@.yahoo.com> wrote in message
news:1179264486.895840.101790@.n59g2000hsh.googlegroups.com...
>I am migrating a Mid-Frame DB to SQL Server 2000 PC.
> I will call oldDB, OldTables the ones that belong to the Mid-Frame.
> I will call newDB, newTables the ones that belong to the PC.
> The oldDB has many versions and I have retrieved the oldTables to CSV
> Files and then I use DTS to make a oldTables as tempTables in SQL 2000
> PC.
> I need to transform data and process the columns in tempTables to
> create the NewTables (ie Final Tables).
> I have used SQL scripts with UDFs to accomplish one run for one
> version of OldDB to newDB.
> The question is : Should I use ADO.NET or embedded SQL to process the
> TemPTables
> And CSV Files or Should stick with SQL SELECT, INSERT, UPDATE scripts
> to do this ?
> I have used SQL scripts with a dozen UDFs, is it time to start using
> other tools /objects like SPs ?
>
> GigaThanksInAdvance
>

Big Picture Advice please to a SQL 2000 intermediate/beginner user

I am migrating a Mid-Frame DB to SQL Server 2000 PC.
I will call oldDB, OldTables the ones that belong to the Mid-Frame.
I will call newDB, newTables the ones that belong to the PC.
The oldDB has many versions and I have retrieved the oldTables to CSV
Files and then I use DTS to make a oldTables as tempTables in SQL 2000
PC.
I need to transform data and process the columns in tempTables to
create the NewTables (ie Final Tables).
I have used SQL scripts with UDFs to accomplish one run for one
version of OldDB to newDB.
The question is : Should I use ADO.NET or embedded SQL to process the
TemPTables
And CSV Files or Should stick with SQL SELECT, INSERT, UPDATE scripts
to do this ?
I have used SQL scripts with a dozen UDFs, is it time to start using
other tools /objects like SPs ?
GigaThanksInAdvanceGiga,
IMHO, if it works for you the way you're doing it, then I reckon stick with
it until you're comfortable moving to other features of SQL like stored
procs.
ADO.NET or SQL to me makes no diff if the end result is the same. You might
find things process quicker with native SQL commands. And there's not much
difference between scripts which run your UDFs or SPs to run them. Scripts
you run in QA will give you more of a visual on what's going on.
cheers
Danny
<placidite1@.yahoo.com> wrote in message
news:1179264486.895840.101790@.n59g2000hsh.googlegroups.com...
>I am migrating a Mid-Frame DB to SQL Server 2000 PC.
> I will call oldDB, OldTables the ones that belong to the Mid-Frame.
> I will call newDB, newTables the ones that belong to the PC.
> The oldDB has many versions and I have retrieved the oldTables to CSV
> Files and then I use DTS to make a oldTables as tempTables in SQL 2000
> PC.
> I need to transform data and process the columns in tempTables to
> create the NewTables (ie Final Tables).
> I have used SQL scripts with UDFs to accomplish one run for one
> version of OldDB to newDB.
> The question is : Should I use ADO.NET or embedded SQL to process the
> TemPTables
> And CSV Files or Should stick with SQL SELECT, INSERT, UPDATE scripts
> to do this ?
> I have used SQL scripts with a dozen UDFs, is it time to start using
> other tools /objects like SPs ?
>
> GigaThanksInAdvance
>