SQL Server 2005 Unable To Read Image Data

Nov 27, 2006

This just happened today and I dont know why.  I have a database on a SQL server 2005 database, that has a table called photos.  It contains image data, but not the column says <Unable to read data>.  But before that I get an error when I try to execute the table to retreive the data.  The error is below.
 
SQL Execution Error:
Executed SQL statement: SELECT ID, AlbumID, Caption, BytesOriginal, BytesFull, BytesThumb FROM Photos
Error Source: System.Data
Error Message: Invalid attempt to Read when reader is closed.
 
This happens with SQL Server Management Studio, and Visual Studio 2005 when I try to access it.  I tried two computers so its not that.  Any help or insight would be appreciated. 

View 2 Replies


ADVERTISEMENT

Read Image Data From SQL Server

Sep 19, 2007

Here is my task  I am storing pdf's in sql server. I would like to retrieve the binary data from sql server and write the pdf content into an existing aspx page to the appropriate pageview section.  What is the best way to handle this.  The code works below but it loads a new browser with the content.  I need it to appear in it's tabbed section in the original aspx file.  Any assistance you can give me would be greatly appreciated.
 Thanks Jerry
oSQLConn.Open()Dim myreader As SqlDataReader
myreader = myCommand.ExecuteReader
Response.Expires = 0
Response.Buffer = True
Response.Clear()
Do While (myreader.Read())
Response.ContentType = ("application/pdf")Response.BinaryWrite(myreader.Item("img_content"))
Loop

View 5 Replies View Related

Image Data Read From SQL Server Does Not Show Up

Mar 4, 2004

Hi Guys,

I've been strugling with this problem all morning today.

Basically I store images in SQL Server 2000 database and then whould like to show them with

<img src="viewImage.aspx?image_id=10" border=1>


My table structure is setup this way

TABLE [userImages] (
[imageFilename] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[imageContentType] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[imageFileSize] [bigint] NULL ,
[imageFileImage] [image] NULL )


and in viewImage.aspx I have:

if (dr.Read())
{

Response.ContentType = dr.GetString(dr.GetOrdinal("imageContentType"));
Response.BinaryWrite( (byte[]) dr["imageFileImage"] );
}


I have no prolems retrieving the data from DB. But the image does not display(in IE it shows a broken link image)

What's even more puzzling is I CAN display the same image from HDD like so:

FileStream fs = File.OpenRead("D:\my_image.png");
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
fs.Close();

Response.ContentType = "application/octet-stream";
Response.BinaryWrite(buffer);


Am I missing something very obvious. I tried playing around with different ContentType's same result.

In my case I am forced to store images in the DB.

I've seen other examples on the net and theirs work. Please help.

Sincerely,
Vlad Orlovsky

View 1 Replies View Related

Sending Uploaded Image To Data Access Class When Storing Image In SQL Server 2005

Apr 20, 2007

I am using the 3-tiered architecture design (presentation, business laws, and data acess layers). I am stuck on how to send the image the user selects in the upload file control to the BLL and then to the DAL because the DAL does all the inserts into the database. I would like to be able to check the file type in the BLL to make sure the file being uploaded is indeed a picture. Is there a way I can send the location of the file to the BLL, check the filetype, then upload the file and have the DAL insert the image into the database? I have seen examples where people use streams to upload the file directly from their presentation layer, but I would like to keep everything seperated in the three classes if possible. I also wasn't sure what variable type the image would be in the function in the BLL that receive the image from the PL. If there are any examples or tips anyone can give me that would be appreciated.

View 2 Replies View Related

How Can I Read From Image Data Type

May 11, 2001

I want to store my MS-Word documents and Excel sheets in the database. So, i have used
the image datatype. Iam not able to download the documents from the database.
i have used getBytes() method. But when i try to download excel sheet document, i get
a error message saying, "File error: data may have been lost".
Can i get some help. can u say how can i put word and excel docs in the database and
retrieve it.
regards,
sathish

View 2 Replies View Related

Read Write Image Data With Sqlceserver

Oct 19, 2006

I was wondering if it is possible to read image data from a database in .net compact framework. Since cf does not have image.fromstream(memstream) to work with, I don't know how else to read the image from the database and then place it into a picturebox.

Here is the code I have been trying out:

Dim Img As Image
'
Dim conn As New SqlCeConnection("Data Source = My Documents est2.sdf")


conn.Open()

Dim sql As String = "SELECT * FROM Dater"
Dim cmd As New SqlCeCommand(sql, conn)
Dim reader As SqlCeDataReader = _
cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)

While reader.Read()

TextBox1.Text = reader.Item("name")
Dim b(reader.GetBytes(1, 0, Nothing, 0, Integer.MaxValue) - 1) As Byte

reader.GetBytes(1, 0, b, 0, b.Length)
Dim ms As New System.IO.MemoryStream(b)
Dim bmp As New Bitmap(ms) <-Error: Value does not fall within expected range
Img = bmp

End While

PictureBox2.Image = Img



I get an error ,Value does not fall within expected range.

Does this mean the image was not save correctly in the database?

Thanks for any help

View 1 Replies View Related

XML Data Source .. Expression? Variable? Connection? Error: Unable To Read The XML Data.

Feb 23, 2008

RE: XML Data source .. Expression? Variable? Connection? Error: unable to read the XML data.

I want my XML Data source to be an expression as i will be looping through a directory of xml files.

I don't see the expression property or the connection property??

I tried setting the XMLData property to @[User::filename], but that results in:

Information: 0x40043006 at Load XML Files, DTS.Pipeline: Prepare for Execute phase is beginning.
Error: 0xC02090D0 at Load XML Files, XML Source [108]: The component "XML Source" (108) was unable to read the XML data.
Error: 0xC0047019 at Load XML Files, DTS.Pipeline: component "XML Source" (108) failed the prepare phase and returned error code 0xC02090D0.
Information: 0x4004300B at Load XML Files, DTS.Pipeline: "component "OLE DB Destination" (341)" wrote 0 rows.
Task failed: Load XML Files
Information: 0xC002F30E at Bad, File System Task: File or directory "d:jcpxmlLoadjcp2.xml.bad" was deleted.
Warning: 0x80019002 at Package: The Execution method succeeded, but the number of errors raised (2) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
SSIS package "Package.dtsx" finished: Failure.
The program '[3312] Package.dtsx: DTS' has exited with code 0 (0x0).


Thanks for any help or information.

View 3 Replies View Related

Read Image From Sql Server

Aug 6, 2007

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 ProjectsWSserviceApp_CodeService.cs:line 48"-----


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


Thank you!





View 3 Replies View Related

Sql 2005 Error: Unable To Read Local Eventlog (reason: 87).

Oct 10, 2005

on the same machine both 2000 and 2005.

View 13 Replies View Related

How Can I Read An Image Which Is In The MSSQL Server Database?

Aug 23, 2005

How can I read an Image which is in the MSSQL Server database?

View 2 Replies View Related

Read Large Binary Data From Sql Server 2005

Jul 14, 2007

Hi I've followed a tutorial on how to write and read varbinary(max) data to and from a database. But when i try to read the data i get the error that the data would be truncated, but only when the varbinary(max)  is greater then 8kB. I've used a system stored procedure (sp_tableoption) to set the table that holds the data to store data outside rows. To select the data i'm using a stored procedure:               SELECT imageData , MIMEType FROM Pictures WHERE (imageTitle = @imageTitle)        And then using an .aspx page to Response.Write the data:Using conn As New sql.SqlConnection            conn.ConnectionString = ConfigurationManager.ConnectionStrings("myConnectionString").ToString            Dim getLogoCommand As New sql.SqlCommand            getLogoCommand.CommandType = Data.CommandType.StoredProcedure            getLogoCommand.CommandText = "GetPicture"            getLogoCommand.Connection = conn            Dim imageTitleParameter As New sql.SqlParameter("@imageTitle", Data.SqlDbType.NVarChar, 200)            imageTitleParameter.Value = Request("imageTitle")            imageTitleParameter.Direction = Data.ParameterDirection.Input            getLogoCommand.Parameters.Add(imageTitleParameter)            conn.Open()            Using logoReader As sql.SqlDataReader = getLogoCommand.ExecuteReader                logoReader.Read()                If logoReader.HasRows = True Then                    Response.Clear()                    Response.ContentType = logoReader("MIMEtype").ToString()                    Response.BinaryWrite(logoReader("imageData"))                End If            End Using            conn.Close()        End Using  Can anyone please help me with this?!

View 2 Replies View Related

Unable To Display Image Loaded Into SQL Server

Dec 16, 2006

Hello, I'm using a multipart/form-data upload to put an image into SQLServer, and it appears to be working, but I'm unable to display theimage. All I'm getting is the text of the URL we're on in Firefox anda missing image icon in IE! Any ideas why this isn't working? Here'sthe image upload code:Dim intImageSize As Int64Dim strImageType As StringDim ImageStream As StreamintImageSize = Picture.PostedFile.ContentLengthstrImageType = Picture.PostedFile.ContentTypeImageStream = Picture.PostedFile.InputStreamDim ImageContent(intImageSize) As ByteDim intStatus As IntegerintStatus = ImageStream.Read(ImageContent, 0, intImageSize)'make connection, write SPs, open connection, etc.TrydbComm.ExecuteNonQuery()Connect.closeCatch SQLexc As SqlExceptionResponse.Write("Insert Failed. Error Details are: " &SQLexc.ToString())End Try--------------And now the display code:'make connection, then SELECT Image, Imagetype FROM Pets WHERE[User]=@user AND Petn=@petn'stored proceduresDim Reader As SqlDataReaderReader = dbComm.ExecuteReader(CommandBehavior.CloseConnecti on)If Reader.read=True ThenResponse.ContentType = Reader(1)Response.BinaryWrite(Reader(0))ElseEnd IfReader.closeConnect.close----------------------------Thanks.

View 1 Replies View Related

Unable To Export Sub-report Data In Excel Format In SQL Server 2005 Reporting Service

Dec 20, 2006

Hello,

I am using 'SQL Server 2005 Reporting Service' in my project. I am using sub-reports in many cases. Whenever I export such reports containing sub-reports to 'Excel' format which is the major client requirement in our project, the exported excel file shows 'Subreports within table/matrix cells are ignored.'

Can anybody tell me the solution for this? If not possible in reporting service then is there any other way to get data in excel format?

Thanks.

-Salil



View 1 Replies View Related

Storeing PDF's In SQL 2005 Using Image Data Type, Not Working...

Jul 20, 2007

Hi everyone, I have an odd problem.  I have a generic upload/download ASP.net page that allows the upload and download of and type of file.  I have so far tested the following file types:
XLS, MDB, JPG, DLL, EXE, PDF, TXT, SWF, and GIF
All of these upload and download fine, EXCEPT PDF's.  I have tried 4 different PDF's and all open prior to upload/download, but after uploading and downloading, I get the following (from Adobe Reader) error upon trying to open:
"There was an error opening this document.  The file is damaged and could not be repaired"
 Here's my current code:
9      Protected Sub ItemCommand_Click(ByVal sender As System.Object, ByVal e As RepeaterCommandEventArgs)10   11       If e.CommandName = "open" Then12         Dim sqlConn As New SqlConnection(ConfigurationManager.ConnectionStrings("data_partsbranding").ConnectionString)13         Dim sSQL As New StringBuilder14         Dim sqlCmd As SqlCommand15         Dim sqlReader As SqlDataReader16         Dim byteArray(UploadedFile.PostedFile.InputStream.Length) As Byte17   18         sSQL.Append(" SELECT      * ")19         sSQL.Append(" FROM        [survey_document] ")20         sSQL.Append(" WHERE       [sd_document_code] = @sd_document_code ")21   22         sqlCmd = New SqlCommand(sSQL.ToString, sqlConn)23   24         sqlCmd.Parameters.AddWithValue("@sd_document_code", e.CommandArgument)25   26         sqlConn.Open()27         sqlReader = sqlCmd.ExecuteReader28   29         While sqlReader.Read30   31           Response.ContentType = sqlReader("sd_mime_type").ToString()32           Response.BinaryWrite(sqlReader("sd_document"))33           Response.AddHeader("Content-Disposition", "attachment;filename=" & sqlReader("sd_file_name").ToString())34         End While35   36         sqlReader.Close()37         sqlConn.Close()38   39       End If40   41     End Sub42   43     Protected Sub btnInsert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInsert.Click44   45       'Make sure a file has been successfully uploaded46       If UploadedFile.HasFile Then47   48         'Connect to the database and insert a new record into Products49         Dim sqlConn As New SqlConnection(ConfigurationManager.ConnectionStrings("data_partsbranding").ConnectionString)50         Dim sSQL As New StringBuilder51         Dim sqlCmd As SqlCommand52         Dim byteArray(UploadedFile.PostedFile.InputStream.Length - 1) As Byte53   54         'Read the files binary data into a Byte array55         UploadedFile.PostedFile.InputStream.Read(byteArray, 0, byteArray.Length)56   57         sSQL.Append(" INSERT INTO [survey_document] ")58         sSQL.Append(" (           sd_document ")59         sSQL.Append(" ,           sd_title ")60         sSQL.Append(" ,           sd_file_name ")61         sSQL.Append(" ,           sd_upload_date ")62         sSQL.Append(" ,           sd_mime_type ")63         sSQL.Append(" ) VALUES (  @sd_document ")64         sSQL.Append(" ,           @sd_title ")65         sSQL.Append(" ,           @sd_file_name ")66         sSQL.Append(" ,           @sd_upload_date ")67         sSQL.Append(" ,           @sd_mime_type ")68         sSQL.Append(" ) ")69   70         sqlCmd = New SqlCommand(sSQL.ToString, sqlConn)71   72         sqlCmd.Parameters.AddWithValue("@sd_title", FileTitle.Text.Trim())73         sqlCmd.Parameters.AddWithValue("@sd_mime_type", UploadedFile.PostedFile.ContentType)74         sqlCmd.Parameters.AddWithValue("@sd_file_name", System.IO.Path.GetFileName(UploadedFile.PostedFile.FileName))75         sqlCmd.Parameters.AddWithValue("@sd_upload_date", Now)76         sqlCmd.Parameters.AddWithValue("@sd_document", byteArray)77   78         sqlConn.Open()79         sqlCmd.ExecuteNonQuery()80         sqlConn.Close()81   82       Else83   84         'Either the file upload failed or no file was selected85   86       End If87   88     End SubI have also tried the following code as a result of searching far and wide, trying other peoples methods:
 1 Protected Sub ItemCommand_Click(ByVal sender As System.Object, ByVal e As RepeaterCommandEventArgs)
2
3 If e.CommandName = "open" Then
4 Dim sqlConn As New SqlConnection(ConfigurationManager.ConnectionStrings("data_partsbranding").ConnectionString)
5 Dim sSQL As New StringBuilder
6 Dim sqlCmd As SqlCommand
7 Dim sqlReader As SqlDataReader
8 Dim byteArray(UploadedFile.PostedFile.InputStream.Length) As Byte
9
10 sSQL.Append(" SELECT * ")
11 sSQL.Append(" FROM [survey_document] ")
12 sSQL.Append(" WHERE [sd_document_code] = @sd_document_code ")
13
14 sqlCmd = New SqlCommand(sSQL.ToString, sqlConn)
15
16 sqlCmd.Parameters.AddWithValue("@sd_document_code", e.CommandArgument)
17
18 sqlConn.Open()
19 sqlReader = sqlCmd.ExecuteReader
20
21 While sqlReader.Read
22
23 Dim buffer() As Byte = sqlReader("sd_document")
24 Dim blen As Integer = CType(sqlReader("sd_document"), Byte()).Length
25
26 Response.ContentType = sqlReader("sd_mime_type").ToString()
27 Response.OutputStream.Write(buffer, 0, blen,)
28 Response.AddHeader("Content-Disposition", "attachment;filename=" & sqlReader("sd_file_name").ToString())
29 End While
30
31 sqlReader.Close()
32 sqlConn.Close()
33
34 End If
35
36 End Sub
37
38 Protected Sub btnInsert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInsert.Click
39
40 'Make sure a file has been successfully uploaded
41 If UploadedFile.HasFile Then
42
43 'Connect to the database and insert a new record into Products
44 Dim sqlConn As New SqlConnection(ConfigurationManager.ConnectionStrings("data_partsbranding").ConnectionString)
45 Dim sSQL As New StringBuilder
46 Dim sqlCmd As SqlCommand
47 Dim byteArray(UploadedFile.PostedFile.InputStream.Length - 1) As Byte
48
49 'Read the files binary data into a Byte array
50 UploadedFile.PostedFile.InputStream.Read(byteArray, 0, byteArray.Length)
51
52 sSQL.Append(" INSERT INTO [survey_document] ")
53 sSQL.Append(" ( sd_document ")
54 sSQL.Append(" , sd_title ")
55 sSQL.Append(" , sd_file_name ")
56 sSQL.Append(" , sd_upload_date ")
57 sSQL.Append(" , sd_mime_type ")
58 sSQL.Append(" ) VALUES ( @sd_document ")
59 sSQL.Append(" , @sd_title ")
60 sSQL.Append(" , @sd_file_name ")
61 sSQL.Append(" , @sd_upload_date ")
62 sSQL.Append(" , @sd_mime_type ")
63 sSQL.Append(" ) ")
64
65 sqlCmd = New SqlCommand(sSQL.ToString, sqlConn)
66
67 'sqlCmd.Parameters.AddWithValue("@sd_title", PictureTitle.Text.Trim())
68 'sqlCmd.Parameters.AddWithValue("@sd_mime_type", UploadedFile.PostedFile.ContentType)
69 'sqlCmd.Parameters.AddWithValue("@sd_file_name", System.IO.Path.GetFileName(UploadedFile.PostedFile.FileName))
70 'sqlCmd.Parameters.AddWithValue("@sd_upload_date", Now)
71 'sqlCmd.Parameters.AddWithValue("@sd_document", byteArray)
72
73 sqlCmd.Parameters.Add(New SqlParameter("@sd_mime_type", SqlDbType.VarChar))
74 sqlCmd.Parameters.Add(New SqlParameter("@sd_title", SqlDbType.VarChar))
75 sqlCmd.Parameters.Add(New SqlParameter("@sd_upload_date", SqlDbType.DateTime))
76
77 sqlCmd.Parameters.Add(New SqlParameter("@sd_file_name", SqlDbType.VarChar))
78
79 sqlCmd.Parameters.Add(New SqlParameter("@sd_document", SqlDbType.Image))
80
81 Dim bArray(UploadedFile.PostedFile.ContentLength - 1) As Byte
82
83
84
85
86
87
88 UploadedFile.PostedFile.InputStream.Read(bArray, 0, UploadedFile.PostedFile.ContentLength)
89
90 sqlCmd.Parameters("@sd_mime_type").Value = UploadedFile.PostedFile.ContentType
91 sqlCmd.Parameters("@sd_title").Value = PictureTitle.Text.Trim()
92 sqlCmd.Parameters("@sd_upload_date").Value = Now
93
94 sqlCmd.Parameters("@sd_file_name").Value = System.IO.Path.GetFileName(UploadedFile.PostedFile.FileName).ToLower
95
96 sqlCmd.Parameters("@sd_document").Value = bArray
97
98
99 sqlConn.Open()
100 sqlCmd.ExecuteNonQuery()
101 sqlConn.Close()
102
103 Else
104
105 'Either the file upload failed or no file was selected
106
107 End If
108
109 End Sub
110

 This method atleast gives a different error:
 "Adobe Reader could not open '132-171510.pdf' because it is either not a supported file type or the file has been damaged (for examplc, it was sent as an email attachment and wasn't correctly decoded)."
 Please help, it would be appreciated.  Thanks
 

View 5 Replies View Related

Unable To Read Connection String ??

Mar 18, 2008

 I have app.config<connectionStrings>



    <add
name="OrganizationConnectionString" connectionString="Data
      Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|inDebugDatabaseOrganization.mdf;Integrated
Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient"/></connectionStrings>Code behind:

string ConnString
= ConfigurationManager.ConnectionStrings["OrganizationConnectionString"].ConnectionString; I am getting "ConnString" value null. How handle this? 

View 4 Replies View Related

Unable To Display Report Header Image When Deployed

Apr 17, 2007

Hello All,



I am unable to display report header when I deploy the reports on report server (Internet). However, they look perfect when previewed in the BI studio. Any clue where could be the problem?



Thanks in Advance!

Rashi

View 3 Replies View Related

Unable To Read East Asian Characters

Jan 10, 2008



Hello

We seem to be having junk characters within our SQL server 2005 database for data related to East Asian countries. However, if we are to manually mess around within Excel we will be able to decipher these characters.

Following is a sample:

Îâê»
mr ºÃ²Ã‡¿
ms Íõá°
»§Ã“ê´º
Ö콨Ò»

Can you please let me know the best way of fixing this issue?

View 1 Replies View Related

Report Builder - Read Data From SQL Server With Ntext Data Type

Apr 16, 2008

Hi all,

I have a column in SQL server which is of type ntext. Selecting the specific column to view it in report builder, an error message appears with the following description:

- Cannot run this report. The grouping expression 'nameofcolumn' returns the datatype binary. The Grouping Expression cannot return binary data.

Report Builder recognises this as if it was an image...

Thanks in advance!

View 2 Replies View Related

Posting An Image To SQL Server 2005

Jun 22, 2007

Hello Everyone I am trying to write image files to sql server using the following code. I have recieved the following error message
Failed to convert parameter value from a String to a Byte[].  Please help.  I am sure it is a problem gathering the iostream.  I am not very familiar.  Any help is gretaly appreciated.
Thanks in advance
Here is the code:
'Dim User As MembershipUser = Membership.GetUser(CreateUserWizard1.UserName)
'Dim t As TextBox = DirectCast(FormView1.FindControl("aspnet_UserID"), TextBox)Dim objConn As SqlConnection
Dim objCom As SqlCommand
If Me.FileUpload1.HasFile Then
Dim fileExtension As String
Dim fileOK As Boolean = False
fileExtension = System.IO.Path. _
GetExtension(FileUpload1.FileName).ToLower()Dim allowedExtensions As String() = _
{".jpg", ".jpeg", ".png", ".gif", ".mwv"}For i As Integer = 0 To allowedExtensions.Length - 1
If fileExtension = allowedExtensions(i) Then
fileOK = True
End If
Next
'TryDim imagestream As System.IO.Stream = FileUpload1.FileContent
Dim data() As ByteReDim data(imagestream.Length - 1)
imagestream.Read(data, 0, imagestream.Length)
imagestream.Close()objConn = New SqlConnection(strNewConnection)
objCom = New SqlCommand("insert into ProfileImagesAndDocs(aspnet_userid,img_name,img_data,img_contenttype)values(@aspnet_userid,@imagename,@Picture,@CategoryName)", objConn)
'---------------------------------------------
'this is the aspnet_useridDim useridparameter As SqlParameter = New SqlParameter("@aspnet_userid", SqlDbType.VarChar)useridparameter.Value = Me.aspnet_userid.Text
objCom.Parameters.Add(useridparameter)
'---------------------------------------------
'This is the image name Dim imagenameparameter As SqlParameter = New SqlParameter("@imagename", SqlDbType.VarChar)imagenameparameter.Value = Me.FileUpload1.FileName
objCom.Parameters.Add(imagenameparameter)
'----------------------------------------------
'this is the picture dataDim pictureParameter As SqlParameter = New SqlParameter("@Picture", SqlDbType.Image)
pictureParameter.Value = data
objCom.Parameters.Add(pictureParameter)
'----------------------------------------------
'this is the profile area or category i.e. video introDim categorynameParameter As SqlParameter = New SqlParameter("@CategoryName", SqlDbType.VarChar)
pictureParameter.Value = "IntroVideo"
objCom.Parameters.Add(categorynameParameter)
 
objConn.Open()
objCom.ExecuteNonQuery()
objConn.Close()
'bookmark
Label1.Text = "File uploaded!"
'Catch ex As Exception
Label1.Text = "File could not be uploaded."
End If

View 2 Replies View Related

Visual Studio 2005 Unable To Connect To SQL Server Express 2005

May 26, 2008

Hi,
I have VS Pro 2005 and SQL Server Express 2005 installed on an XP Pro machine. When using VS 2005, in the 'Server Explorer' window I can see and attach to two SQL Server databases that I have set-up. But if I attempt to access the same databases from withn the 'Solution Explorer' window I get the following dialog box message,

"
Required Component Missing (Dialog box heading)

Connections to SQL Server Files (*.mdf) require SQL Server Express to function properly. Please verify the installation of the component or download from the URL: http://go.microsoft.com/fwlink/?LinkId=49251
"

I have uninstalled and then reinstalled both VS 2005 and SQL Server Express twice but it has helped.

I don't understand why I'm getting this error because all of the server configuration tools and connection utilities seem to work fine but VS say's that SQL Server Express is not installed.


Thanks,

CLN

P.S.
I had another application that required MSDE 2000A to be installed. When I removed the other application I also removed MSDE 2000A and that's when the problem began.

View 3 Replies View Related

SQL Server Image Data

Jul 20, 2005

Hi! Guys,May be this question is little stupid but I want to clarify this.Let suppose I have image data field in Sql server 2000 and I am uploadingan image of 10KB(thru asp.net application).What would be the size for that table with image data field ?Is it 10KB or less than 10KB or more than 10KB ?ThanksJohnwww.e-classifiedad.com

View 2 Replies View Related

Unable To Debug SQL Server 2005 Stored Procedures From Another Workstation Running Visual Studio 2005

Sep 18, 2006

I'm having some problems debugging SQL Server stored procedures on a SQL Server 2005 server. I have installed Visual Studio 2005 on a workstation running Windows XP, now I'm trying to debug a ASP.Net web application that has some code that executes the stored procedures on a Windows 2003 Server running SQL Server 2005.

I opened VS2005 ... created a connection to the SQL Server 2005 instance ... open the Stored procedure ... right click the stored procedure name and selected Step into Stored Procedure and the following message is displayed:

Unable to start T-SQL debugging.Could not attach to SQL Server process on 'ServerName'.

Any ideas.



Thanks,

View 2 Replies View Related

Insert Image Into Table SQL Server 2005

Jun 27, 2007

I have a table tblImage with column ImageName as varchar(50)  and picture as Image
 I am trying to Insert picture I have in C: drive into table using the following code
Insert into tblImage (ImageName, Picture)
Select 'Dog' as ImageName, Bulkcolumn from OPENROWSET(BULK N'C:dog1.jpg', SINGLE_BLOB) as picture
 I am getting error message.
Can I insert image into table through query.
Thanks in advance.
 
 

View 3 Replies View Related

[LOG] Unable To Read Local Eventlog (reason: The Parameter Is Incorrect)

Apr 12, 2007

This error message gets into my SQL Agent Error Logs every couple of seconds after the clusters migrated from the EMC Clariion CX500 to the CX3-80.

OS €“ Win 2003
SQL €“ SQL Server 2005 SP1 (9.00.2047.00)

View 3 Replies View Related

SSIS Package Unable To Read File From Shared Location.

Jul 17, 2006

 

We are trying to import data from a .csv file which sits on shared location. This package runs fine when we run it from designer. but we are having problem when we do it at run time (accessing it through a service). Same package runs fine if that file is on same server.

Is any one gone through this issue before? i appreciate any help in resolving this issue.

 

--------Log----

#Fields: event,computer,operator,source,sourceid,executionid,starttime,endtime,datacode,databytes,message
OnPreValidate,SMSPAD1125M,RFCGKommar1,GIRI_ETL_XREF,{4D456D56-B35F-4FCC-8A89-2D03AC545C76},{5395DAA0-DB96-49CA-BDE7-0DA5C623A2B0},7/17/2006 10:46:42 AM,7/17/2006 10:46:42 AM,0,0x,(null)
OnError,SMSPAD1125M,RFCGKommar1,GIRI_ETL_XREF,{4D456D56-B35F-4FCC-8A89-2D03AC545C76},{5395DAA0-DB96-49CA-BDE7-0DA5C623A2B0},7/17/2006 10:46:42 AM,7/17/2006 10:46:42 AM,-1073659875,0x,Connection "FlatFile" failed validation.

---------------------------------

Thanks,

-G

 

 

View 3 Replies View Related

Storing Image In Sql Server 2005 In Binary Format?

Nov 1, 2006

please mail me at lavkesh_kumar@yaho.com

View 2 Replies View Related

Adding A Jpeg Image To A SQL Server 2005 Table

Dec 9, 2007



I want to add a product photo in jpeg format to a products table. I'm storing the image of the product in separate jpeg files located in a folder on the same server that houses SQL Server. I don't want to store the photo directly in the table. I just want to reference the file location of the jpeg photo in a record.

Can someone provide me with code I need to add to the photo column for each record in the products table in order to reference the location of the jpeg photo associated with that record?

Subsequently, I want the photo to pop up in SQL Server Reporting Services product report.

Thank you.

David

View 1 Replies View Related

Read Only ODBC To SQL SERVER 2005

Jul 11, 2007

I have a Login that I setup in SQL Server 2005.  The only database roles given to the login are db_datareader and public.  On SQL 2000 these permissions are sufficient to allow me to setup a read only ODBC connection using this login and creating an import table in Access.  When using the login in SQL 2005 and creating an import table, I am able to edit the underlying data, something I am not able to do with a  SQL 2000 ODBC connection.  Is there something in SQL 2005 that I am unaware of that would allow this login to modify (update) the table? 

View 6 Replies View Related

MDF File Cannot Be Read By SQL Server 2005

Feb 10, 2006

Newbee question: I am trying to use some of the "101" samples in VS 2005 with SQL Server 2005. These samples use SQL server express MDF files.

The error is: "... you cannont open a database that is incompatible with this version of sqlservr.ext. You must re-create the database."

Do I need to install SQL server express? What are the issues with installing express when I am already running SQL Server 2005?

How do I update or "re-create" the express MDF database file in SQL Server 2005?

Thanks!

View 3 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

To Include Image In SQL Server 2005 Express Reporting Tool

Mar 13, 2007

Hi, I have a field in database that keep the image location. How to display the image in the report ?
Any idea.
Thanks.

View 2 Replies View Related

Inserting Image Data Type From SQL Server CE To SQL Server 2000.

Oct 23, 2006

Hi All,

I am manually replicating parts of a SQL Server CE database (running windows mobile 5.0) to a centralized SQL Server 2000 database.

My program is throwing an exception whenever I try to insert an image data type into the 2000 server from the PDA. I am using parameterized queries.

Error is as follows:
[error]
System.Data.SqlClient.SqlConnection.OnError()
at
System.Data.SqlClient.SqlInternalConnection.OnError()
at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at
System.Data.SqlClient.TdsParser.Run()
at
System.Data.SqlClient.ExecuteReader()
at
System.Data.SqlClient.ExecuteNonQuery()
at
PDASync.Database.ExecuteIDRemote()
[/error]

The code for my ExecuteIDRemote method works fine for other queries. It also works if I remove the image column from the offending query.

Does anyone have any suggestions? Thanks.

View 1 Replies View Related

Can Distributed Query Read Sql Server 2000 From Sql Server 2005?

Nov 29, 2007

if it is possible to run a distributed query against 2000 from 2005, what would the OPENDATASOURCE parameters look like? I'd like to be able to pivot without copying my older 2000 db to 2005 or using linked servers..

For reference, here's an example of a distrib query that reads excel...

ie SELECT * INTO XLImport3 FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=C: estxltest.xls;Extended Properties=Excel 8.0')...[Customers$]

View 1 Replies View Related







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