Inserting Data Into Text Or Image Data Type
Hi all,
Pls tell me how to insert large data into text or image data type of MS SQL Server using Java.
Waiting for reply.........
View Complete Forum Thread with Replies
Related Forum Messages:
How To Convert To Regular Text, Data Stored In Image Data Type Field ????
Hi,This is driving me nuts, I have a table that stores notes regarding anoperation in an IMAGE data type field in MS SQL Server 2000.I can read and write no problem using Access using the StrConv function andI can Update the field correctly in T-SQL using:DECLARE @ptrval varbinary(16)SELECT @ptrval = TEXTPTR(BITS_data)FROM mytable_BINARY WHERE ID = 'RB215'WRITETEXT OPERATION_BINARY.BITS @ptrval 'My notes for this operation'However, I just can not seem to be able to convert back to text theinformation once it is stored using T-SQL.My selects keep returning bin data.How to do this! Thanks for your help.SD
View Replies !
Move Text Data (not A File) Into An Image Data Type
The ERP manufacturer used an image data type to store large text data fields. I am trying to move these data types from one database to another database using either Sql Queries or MS Access. I can cast them as an 8000 char varchar to read them directly but have no luck importing into these image data fields. Access and Crystal are not able to read these fields directly. Any suggestions? Most information about these fields has to do with loading files but I am just moving data. Thanks, Ray
View Replies !
Inserting The Data Into Text Data Type
Hi everybody, In our datbase we have a table with text data type.Help me if anybody knows how to insert text data into text data type of sql server. i am able to modify and retrive but i am not able to insert text. please if u have idea, please give me reply asap. Thanks, Giri
View Replies !
Using Inserted / Deleted Tables With Text / NText / Image Data Type
Hi folks, Table: a int, b int, c int, d text I need to change my AFTER - Trigger from this (example!): select * into #ins from inserted to something like select *(without Text / nText / image -columns) into #ins from inserted. So I tried to build a string like this: (using INFORMATIONSCHEMES) select @sql = 'select a,b,c into #ins from inserted' exec(@sql) a,b,c are not of Text, nText or Image datatype. After executing the trigger, I get an error, that inserted is unknown. Does anyone know how to solve this ? Thx.
View Replies !
Inserting Image Data Type From SQL Server CE To SQL Server 2000.
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 Replies !
Converting Numeric Data Type To Text Data Type
Hi,I would like to convert a dollar amount ($1,500) to represent Fifteenhundred dollars and 00/100 cents only for SQL reporting purposes. Isthis possible and can I incorporate the statement into an existingleft outer join query.Thanks in advance,Gavin
View Replies !
Convert Text Data Type To Smalldatetime Data Type
I have a field that is currently stored as the data type nvarchar(10), and all of the data in this field is in the format mm/dd/yyyy or NULL. I want to convert this field to the smalldatetime data type. Is this possible? I've tried to use cast in the following way, (rsbirthday is the field name, panelists is the table), but to no avail. SELECT rsbirthday CAST(rsbirthday AS smalldatetime) FROM panelists the error returned is "incorrect syntax near 'rsbirthday'. I'm rather new to all things SQL, so I only have the vaguest idea of what I'm actually doing. Thanks for the help!
View Replies !
System.Data.SqlClient.SqlException - When Inserting Image
Hi All, I have a form (asp website with the default.aspx and default.aspx.cs) which I use to connect to the SQL Server 2005 database and insert, update,get and delete data to and from it. In the table I have a column called Picture to insert a photo (usually bmp files) which I declared as a varbinary(max). ID is the primary key and is an int (i tried it to be numeric & varchar). I am trying to insert data into the table using a form with this syntax: SqlConnection enter_conn = new SqlConnection("user id=;" + "password=;server=servername;" + "Trusted_Connection=yes;" + "database=Member Profiles; " + "connection timeout=30"); enter_conn.Open(); string insertSql = "Insert dbo.Details(ID,Last_Name,First_Name,Middle_Initial,Project, Organization,Manager,Current_Skills,Biography,Hobbies, Picture) Select 1001, 'ABC','XYZ','R',' Website Development','ACT',LKM','ASP.Net, C#.Net, SQL Server 2005, SharePoint, Java, ',' developing the new website for ACT using SharePoint and SQL Server 2005', ' Singing, Listening to Music, Dancing, Cooking, Swimming', BulkColumn from Openrowset( Bulk 'C:\photos\rose.bmp', Single_Blob) as Picture"; SqlCommand myCommand = new SqlCommand(insertSql, enter_conn); int i = myCommand.ExecuteNonQuery(); I have no data in the table and am doing the first insert. Though the data gets inserted I am getting this exception: System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK_Details'. Cannot insert duplicate key in object 'dbo.Details'. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at _Default.Enter_Click(Object sender, EventArgs e) in c:Documents and SettingskrkondaXMy DocumentsVisual Studio 2005WebSitesMember ProfilesDefault.aspx.cs:line 82 Can someone please suggest anything???? I appreciate a quick response please!!!! Thanks, Kavya
View Replies !
Image Data Type
I have a field in my personal table that has image data type as Pic,my SQL code is : SELECT Department.ID,Department.[Name],Department.CreatedDate,Department.[Pic] ,COUNT([Group].[Name]) FROM Department INNER JOIN [Group] ON Department.ID=[Group].DepartmentID Group by Department.ID,Department.[Name],Department.CreatedDate,Department.[Pic] This error occured : Msg 306, Level 16, State 2, Line 1 The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. Please help me. Thanks.
View Replies !
Image Data Type
hi, i'm a student doing my final year project. during the user requirements stage, my client proposed storing all files (.doc, .jpg, .mp3) into the sql database. i found out that the way to do this is to write the files as binary data in order to store them in the database. my concern is will this data storage overload the database server? i read somewhere that the retrieval of data as binary data is the same as retrieving text. but the estimation of users is around 27,000.. if i'm not wrong, the sql database server should be MS SQL Server 2005, or at least 2003.
View Replies !
Image Data Type
I have been asked to write a piece of code that will insert an image object into a database using a stored procedure and the Microsoft Enterprise Library. Has anyone done this before? Do you have any code examples about how to update a database with an image datatype that needs to be chunked, etc... In this instance, I need to open up a word document and save the contents as an image in a database.
View Replies !
Image Data Type
Hi,In my SQL Server 2000, I have a Table MyUser which has one colum PassWord,and the PassWord's datatype is Image. I'm wondering how can a password bean image.Thanks for help.Jason
View Replies !
Image Data Type
I'm developing a website with SQL SERVER 2000 and IIS6 (beta). I'm using ASP.NET webforms for my application. I was wondering if anyone knows how to use the Image datatype for dynamically loading images/word docs/sound files
View Replies !
About Image Data Type
Hi! we know there is data type -- image, when i wanna input real image into these kind of data type, i usually use access to achieve this goal, but i think if i have no access, i will face to trouble! could you tell me how i can input real image into image data type by means of SQL? thanx very much!
View Replies !
Image Data Type
Hi, I have a table with a column having image data type in it.I need to move four records from this table to another table in development box.Can any one suggest me how can i do this? I don't think insert into select * will insert image data type.Is there any way around? thanks Mohan
View Replies !
Image Data Type
pls. Help! I am not getting that how to use the image datatype in sql server 2000 when i am inserting text to it and on retrieving it is showing hexadecimal string ... I want to know all of your views on the usage of image datatype.. Thanks...
View Replies !
Store Image Data Type
Hi when I store html file with image in image data type of database sqlserver, where will actual data store (content of html file, and file image which display on html file), in which folder Can I help you
View Replies !
The Size Of The Image Data Type
I'm using ODBC to interface a Microsoft SQL Server 2000. One of theoperations involves placing files within BLOBs. I'm using the imagedata type for this purpose. Most of the time this works okey, but whentrying to add a 21,3 MB file I get an error. The error code is 22001,which means "String right-truncation". But why? Does this mean thatthe field cannot accepts BLOBs with this size?
View Replies !
Image Data Type Size
I need to store images in MS SQL. I have the upload procedures and stuff but I'm missing the point about the image data type size. It is supposed to be able to store up to 2Gb!!! but when I declare the data field image I can't specify the max size for the field and by default is 16 !! 16 bytes!! what can I do with that? How can I insert a file? Please help
View Replies !
Operating On The Image Data Type
How to insert or retrieve images type data in sql server?I want to put a jpeg file in sql server.How can I accomplish that?>How to input into the table and how to retrieve that from the table I have a table contacts.The fields are ID int Name Varchar Photo Image Can anyone help me with this?
View Replies !
How Can I Read From Image Data Type
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 Replies !
Contains Function On Image Data Type
Hi all, I am working on application maintance. I got a Contains(myField, myString) that used to look into an image data type field (text) for the string, but right now it's not responding they way it's supposed to do. Recently really big files have been introduced in the DB, could this related to the issue? Anyone can help regarding this? Many thanks, Giovanni
View Replies !
Dealing With Data Type Image
Hi everyone, Apology if this question doesn't belong to here. I've created a table in SQL database with a field of type image, I also have a imge box on the web form where the user can browse for the file. So I need help in completing the code to replace the question marks. =================================================================== Protected Sub cmdSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdSubmit.Click Dim eSurveyAdd As New SqlDataSource() eSurveyAdd.ConnectionString = ConfigurationManager.ConnectionStrings("CITSSurveyConnectionString1").ToString eSurveyAdd.InsertCommandType = SqlDataSourceCommandType.Text eSurveyAdd.InsertCommand = "INSERT INTO SurveyEntry (IT_LastName, IT_FirstName, PR_SnapShot, PR_Comments) VALUES (@IT_LastName, @IT_FirstName, @PR_SnapShot, @PR_Comments)" eSurveyAdd.InsertParameters.Add("IT_LastName", txtLastName.Text.ToUpper()) eSurveyAdd.InsertParameters.Add("IT_FirstName", txtFirstName.Text) eSurveyAdd.InsertParameters.Add("PR_SnapShot", imgSnapShot.???????) eSurveyAdd.InsertParameters.Add("PR_Comments", txtGeneralComments.Text) Dim eProblemOccurred As Integer eProblemOccurred = eSurveyAdd.Insert() If eProblemOccurred <> 1 Then Server.Transfer("FailedSave.aspx") Else Server.Transfer("SuccessfullSave.aspx") End If End Sub =================================================================== (I'm still very new to SQL & Web developer). Many thanks in advance. Try your best, not enough ??, not your fault, just dive in desert.!!
View Replies !
Filling Image Data Type Field
Hi I am currently working on an application that uses a stored procedure to retrieve data from a database and then display it in a web page. My problem is that some of the data in the database will be images, I am currently putting in test data to test my code/procedures my problem is how do I put in test data for images, when I am finished I am going to add an admin section that will allow me to add images that way but how do I go about adding them to the database until then? I have set the field to the image data type but have no idea how to relate this to an image on my server? Thanks, Adam
View Replies !
Image Data Type And Animated Gifs
I have an asp.net 2 app that retrieves images from a SQL Server 2005 Image field in our database. I have this working successfully apart from one problem. When I retrieve an animated gif, the animation is lost. Is there anyway around this?
View Replies !
Copy Image Data Type From One Table To Another
Hi, I've a column col1 of image data type in table1. I would like to copy the data from col1 to another image column col2 in table2. Before moving the value, checking has to be done to specify which col1 data from table1 is needed and the destination has to be checked too. Example: insert into col2 (select col1 from table1 where table1_id =5) where table2_id =6 Hence bcp wouldn't work. Can anyone suggest me a way to do it. I tried using writetext but then, i've to get data from col1 in a variable, which is not possible. Any suggestions would be very helpful. Thanks in advance. Ramya.
View Replies !
Hanling Image Data Type Columns
Hi I have a table with image data type column. I would like to store photos (images in .jpg format) in the table. I am using ADODC to connect VB.NET with MS-SQL server 2000. Thanzzzzzzzzzz... :rolleyes:
View Replies !
Storing Pictures In Image Data Type
Hey all, Just starting to investigate this. I need to store digital pictures in my database for use in claims and disputes. I have played a bit with the image datatype but notice that one picture takes up 1Mb as a TIFF and 3Mb as a JPEG. Does anybody work with this stuff and if you do what is the best picture format to use in regards to keeping clarity but minimizing size used in the db. Is there any load conversion routines that would shrink the size of the file. Any suggestions or comments on this topic are appreciated. Thx. Kelsey
View Replies !
Storing Pictures In Image Data Type
Hey all, Just starting to investigate this. I need to store digital pictures in my database for use in claims and disputes. I have played a bit with the image datatype but notice that one picture takes up 1Mb as a TIFF and 3Mb as a JPEG. Does anybody work with this stuff and if you do what is the best picture format to use in regards to keeping clarity but minimizing size used in the db. Is there any load conversion routines that would shrink the size of the file. Any suggestions or comments on this topic are appreciated. Thx. Kelsey
View Replies !
Image Data Type Insert From One Table To Another
Hi All What is the efficient way of copying any table having Blob (Image Data type) items into another table with same structure . I am trying with the following way and it is taking too long . Table has 127000 rows ... After 3.5 hours also it did not complete using following statement . select * into NewSurveyItem from SurveyItem --=======Table Structure ============ CREATE TABLE [dbo].[SurveyItem] ( [SurveyItemKey] [uniqueidentifier] NOT NULL , [SurveyKey] [int] NULL , [SurveyTypeSectionKey] [int] NULL , [RecommendIndicator] [bit] NOT NULL , [SectionHeader] [nvarchar] (75) NULL , [SectionSequenceNumber] [int] NULL , [SectionData] [image] NULL , [PrintFlag] [bit] NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO Thanks Sujit
View Replies !
MsSQL Image Data Type Truncation
Hello, I am trying to store pictures in an Image data type column of my MsSQL table from PHP, or even SQL Query Analyzer for that matter. In PHP I use the bin2hex() function to get the HEX equivilent of the picture, I'm sure everyone knows that when you convert a Binary file to HEX, the file size is doubled. When I try to insert the HEX file into my table with a query like: INSERT INTO PicTable (fileType, fileData) VALUES ('jpg', 0x47494638396164014100f70000000000ffffff2f2f2fe800020c0c0ce....) MsSQL will store EXACTLY HALF of the file. The byte count of the stored HEX data and original Binary data is exactly the same, so when I try to extract the file and display it, in a browser window for instance, I can see exactly half of the image. I have tried everything I can think of to fix this, but I am at a loss. Does anyone know of anything that would cause this strange behavior. I have no problems at all doing this with MySQL's BLOB data type. Thanks in advance for any help.
View Replies !
Image Data Type And Animated Gifs
I have an asp.net 2 app that retrieves images from a SQL Server 2005 Image field in our database. I have this working successfully apart from one problem. When I retrieve an animated gif, the animation is lost. Is there anyway around this?
View Replies !
Help In Storing Binary To Image Data Type
Hi. how can i store binary data to another field with image data types. here is my sample code --note: [CUD_DOCUMENT] and [RES_DOCUMENT] are image data type DECLARE @CUD_DOCUMENT binary SELECT @CUD_DOCUMENT = CUD_DOCUMENT FROM CUD_CONTINUOUS_UPLOAD_DOCUMENTS INSERT INTO [RES_RESUMES]( [RES_DOCUMENT] -- image data type ) VALUES ( @CUD_DOCUMENT) thnx for the help.
View Replies !
Inserting In An Image Type Column
Hello, I was wondering, how do I insert a file in an Image type column from the SQL server 2000 corporative administrator? I have a table that contains information about all the programs we run here, and I have a column that I set to image type, I want to put the icon of my programs there..
View Replies !
Validate Data Type Before Inserting
I have a temp table which is used to store data before inserting to the real permanent tables. All columns of the temp table have nvarchar type. How do I validate the data in temp table before doing the actual insert? For example, I need to ensure a field is a valid Datetime (currently in temp of nvarchar) before inserting to a Datetime field. Can this be done using Transact-SQL? Thanks.
View Replies !
Storeing PDF's In SQL 2005 Using Image Data Type, Not Working...
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 Replies !
Using Image Data Type In A SQL Server 2000 Table
I have a recordset that joins five tables. Two of the tables contain afield that contains an image (a small bmp file 32x32 pixels).The join looks like this (omitting the other tables tha tdon't containgraphics)SELECT tblMain.UniqueID, tblMain.myField, tblGrahic1.ImageField1,tblGraphic2.ImageField2FROM (tblMains LEFT JOIN tblGraphic1 ON tblMain.ImageID1 =tblGraphic1.ImageID1) LEFT JOIN tblGraphic2 ON tblMain.ImageID22 =tblGraphics2.ImageID2The problem is this is extremely S-L-O-W on slow connections. If Iremove one of the table joins, it's much faster.I'm hoping someone can give me a better way to do this.The recordsource populates a continuous form in Access2K where thegraphics represent visually the settings made by users...Any help is greatly appreciated.lq
View Replies !
Inserting Image Data Fails With Connection Broken (SQL Server 2000 And SQL Native Client)
Dear all, we have tables with many image columns. We fill these image columns via ODBC and SQLPutData as described in MSDN etc (using SQL_LEN_DATA_AT_EXEC(...), calling SQLParamData and sending the data in chunks of 4096 bytes when receiving SQL_NEED_DATA). The SQLPutData call fails under the following conditions with sqlstate 08S01 - The database resides on SQL Server 2000 - The driver is SQL Native Client - The table consists e.g. of one Identity column (key column) and nine image columns - The data to be inserted are nine blocks of data with the following byte size: 1: 6781262 2: 119454 3: 269 4: 7611 5: 120054 6: 269 7: 8172 8: 120054 9: 269 The content of the data does not matter, (it happens also if only zero bytes are written), nor does the data origin (file or memory). All data blocks including no 7 are inserted. If the first chunk of data block 8 should be written with SQLPutData the function fails and the connection is broken. There are errors such as "broken pipe" or "I/O error" depending on the used network protocol. If data no 7 consists of 8173 bytes instead of 8172 all works again. (Changing the 4096 chunk size length does not help) Has anybody encountered this or a similar phenomenon? Thank you Eartha
View Replies !
How To Deal With Image Data Type Within Stored Procedure When Using SQL2000?
Hi, Does anyone know how to deal with image data type within stored procedure when using SQL2000? I have a table and there is an image data type column. In this table I need to make a copy of one row within a table through a SP /it means to retrieve the whole row within SP, change another columns data (but, that the image is not modified) / and save the modified row back to the same table. Problem is, that within SP is not alowed to use local varaibles of image data type. Does anyone know a solution for this? Please. Thank you.
View Replies !
Store Multi-Select Values In An Image Data Type?
I was working on figuring out where a certain application wasstoring the multiple selection choices I was doing through the app.I finally figured out that they were being store in an IMAGEdata type colum with the variable length of 26 bytes.This is the first time I ran into such way of storing multipleselections in a single Image data type.Is this a better alternative than to store into a One-to-Manytables? If so then I'll have to consider using the Image datatype approach next time I have to do something like storing1 to thousands of selections.Thank you
View Replies !
Query Image Data Type Column Using Linked Server
Hi all, When running a query like "select * from test.dev.dbo.table_name" using linked server I have got the following error: OLE DB provider 'SQLOLEDB' reported an error. [SQLSTATE 42000] (Error 7399) OLE DB error trace [OLE/DB Provider 'SQLOLEDB' IRowset::GetNextRows returned 0x80004005: ] Table contains image column. When quering the same with no image column works fine. Steps already done: Reinstalled MDAC 2.7 SP1 Recreated linked server Thanks
View Replies !
|