.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

Inserting image into oracle blob field C#

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :ASP.Net
 
Help. How do I do this. I have spent hours trying to do this.

I have the image as a byte stream...

FileStream fs = new System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read);
byte[] b = new byte[fs.Length - 1];
fs.Read(b, 0, b.Length);
fs.Close();

THIS DOESN'T WORK
string query = "Insert into test1 (age, name, pict) values (54, 'kim', " + b + ")";

SO I STARTED THIS.
string query = "Insert into test1 (age, name, pict) values (54, 'kim', empty_blob())";
DO I NEED TO NEXT DO A SELECT TO retrieve a pointer to the blob and then fill it or something along those lines?
CODE would be very valuable!!


View Complete Post


More Related Resource Links

How to use server side validation to ensure image field is not null

  

I'm having trouble accomplishing the above. Below is all the mark up and code. I'm not getting error messages, but the validate image function is not working (fileupload portion is working ok).

In my attempt below---not sure if it's the simplest or best validation approach anyway---the "UserId" parameter appears during rendering to be empty---but in most methods I have it successfully containing or referring to the logged-in user's identification.

Following is the control that refers to the image field (page = advertisement.aspx):

<asp:Image ID="Image" runat="server" ImageUrl ='<%#Eval("UserId","Image.aspx?UserId={0}") %>'

 

Following is the successful code behind for the page image.aspx referred to above (page = image.aspx.vb):

Partial Public Class Image

    Inherits System.Web.UI.Page

    Public Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Request.QueryString("UserId") IsNot Nothing Then

            ' Get the connection string from Web.config.

            Using conn As New Sq

Read data from BLOB field and write to sharepoint list

  
Hi, I want to read the data from BLOB field and write it into sharepoint list item. Please provide some pointer to archive above objective.   Thanks in Advance.

Datareader: Set multiple random images into appropriate image field

  
Hi, first of all, sorry if my title isn confusing as i dont really sure the specify description regarding what i wan to do.   Now what i trying to do is, I getting 5 random images from the database, this is the code for me to get random 5 records from database: Dim command As New SqlCommand("SELECT TOP 5 Description,Image,ImageID FROM Properties ORDER BY ImageID", con)  and with the help of image handler to display it to 5 Images components i put in the page, lets say name it "Image1" to "Image5". Now the question is, how do i assign the 5 diff imageID into the 5 image components? Lets say i wan my Image1's imageID is 1, and Image2's imageID is 2. What im doing now is assigning all the same imageID to all 5 images. Below is how i assign the imageIDDim reader As SqlDataReader reader = command.ExecuteReader If reader.HasRows = True Then While reader.Read Image1.ImageUrl = "GetThumbnail.aspx?ImageID=" & reader("ImageID") & " " Image2.ImageUrl = "GetThumbnail.aspx?ImageID=" & reader("ImageID") & " " Image3.ImageUrl = "GetThumbnail.aspx?ImageID=" & reader("ImageID") & " " Image4.ImageUrl = "GetThumbnail.aspx

Flat file upload: Error when inserting into datetime field.

  
Hi All I am having an issue with uploading a txt file into an SQL table and one of the fields needs to go into a datetime column. The issue is with column3 I have been into the advanced editor of the flat file source and set the output column to decimal and it fails. The error I am getting is below: Error: 0xC02020A1 at Materials Transfer, Flat File Source [1]: Data conversion failed. The data conversion for column "Column 3" returned status value 2 and status text "The value could not be converted because of a potential loss of data.". Error: 0xC0209029 at Materials Transfer, Flat File Source [1]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "output column "Column 3" (48)" failed because error code 0xC0209084 occurred, and the error row disposition on "output column "Column 3" (48)" specifies failure on error. An error occurred on the specified object of the specified component.  There may be error messages posted before this with more information about the failure. Error: 0xC0202092 at Materials Transfer, Flat File Source [1]: An error occurred while processing file "D:\Development\r3_downloads\mat.txt" on data row 1. Any help would be great.   Thanks BigGopher

Inserting an 'image' (datatype) value through SQl and C++

  
In the application I develop, the database table having a column of 'image' datatype. Now I want to insert the values into that table directly from my program, which is in VC++ 6.0, using a direct ExecuteQuery() of INSERT(due to performance considerations).

Overlay Image in InfoPath with text field

  
Hi, We are currently designing a simple test for some employees to take and it will be delivered via InfoPath forms services. Upon successful completion of the test the userr will be invited to click a button to view (then print) their certificate. The certificate has been received as a .jpg. Is there any way to overlay the image with a text box, as this would enble the user to print a certificate where their name appears on it.

How to retrive client name ,Field , and Image from Database and show in datalist?

  

hi experts,

i wanat to display Client Name, Field and  image in datalist. Stored Procedure like this

ALTER proc [dbo].[get_clients_services]
as
SELECT     Clients.ClientName AS Client, Fields.FieldName AS Field, ServiceType.ServiceType AS Services, ServiceType.Servicelink AS Link, 
                      Clients.ClientLogo AS Logo
FROM         Clients INNER JOIN

Inserting or replacing image on SQL

  

I have a table right now with just customer_id and customer_name and I want to add an image field to upload their logo.

I've searched and found articles on how to create a table and to upload an image for a new row but how do I update or add a picture to an existing row.

So if I browse through my table and found a customer without a logo or an outdated logo, how do I replace and update their logo?

Thanks


Sharepoint image column field

  
My current project requires ability to display choice column value via color or image associated with a choice 

But Sharepoint standard packaged misses that control 

I am looking for available solutions on market 

I came across 
http://sharepointfields.com

Does anybody has experiece using it?

ORA-06550, PLS-00306; Error inserting data to Oracle procedure.

  

I have tried to troubleshoot this problem but to no avail. I get error while inserting a big chuck of data to Oracle package containing procedure 'INSCRAPP'. The error message is,

ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'INSCRAPP' ORA-06550: line 1, column 7: PL/SQL: Statement ignored

The C# code is big but I am providing the parameters I am passing,

oraCmd.Parameters.Clear();

                OracleParameter param_fName_in = new OracleParameter("fName_in", OracleType.VarChar);
                param_fName_in.Value = FirstName;
                param_fName_in.Direction = ParameterDirection.Input;
                oraCmd.Parameters.Add(param_fName_in);
                
                OracleParameter param_mi_in = new OracleParameter("mi_in", OracleType.VarChar);
                param_mi_in.Value = MiddleInitial;
                param_mi_in.Direction = ParameterDirection.Input;
                oraCmd.Parameters.Add(param_mi_in);

                OracleParameter param_lName_in = new OracleParameter("lName_in", OracleType.VarChar);
                param_lName_in.Value = LastName;
                param_lName_in.Direction = ParameterDirection.Input;
                oraCmd.Parameters.Add(param_lName_in);

                OracleParameter para

Inserting InvoiceID "Key" field from Grid into Payment ListDetails "Foreign Key" field

  

Setup: A Grid called InvoiceGrid

            A ListDetails called DetailsView1 (for editing existing payments for the selected invoice)

            A ListDetails called DetailsView2 (in DetailsView1's EmptyDataTemplate for inserting new payments for the selected invoice) 

            A foreign Key restraint setup between the two tables

 

Quesitons:

1) When I select an invoice that does not have a payment associated with it, the DetailsView2 displays as it should,  how do I auto-populate the DetailsView2 "InvoiceID" field with the InvoiceID field selected in the InvoiceGrid ?

2) How do I make the InvoiceID field in DetailsView2 "ReadOnly" so the user cannot accidentaly change it.

3) Is there any kind of Insert conformation that I can display if the payment is successfully inserted ?

 

 

 

PayListDetails 


Stored proc inserting into a identity field

  

We have a table with an identity field

Occasionaly data is archived out to a seperate database (not my design but stuck with it for now).  If an archived record is re-instated we need to insert back into the original table specifying the identity field (so it gets the same ID as last time)

the user performing the task is a bog standard user i.e. Not db_owner or sysadmin.

I have created a stored proc to perform the reinstate and tried to grant execute permissions as db_owner using my sysadmin account but get the message

Grantor does not have GRANT permission.

I have granted myself execute permissions and made myself db_owner but still get the same error.

 

I then tried to specify the GRANT to use my login (sysadmin user) , this went through but I still get the error when executying the stored proc as the standard user

The current user is not the database or object owner of table 'DB.dbo.Table1'. Cannot perform SET operation.

 

Anyone shed any light or am i going to have to rewrite the system to avoid the identity field??


MCDBA, MCAD, MCITP, MCTS

Excel Date Field Import Problem in Oracle SQL Developer

  

Hi All,

I have an Excel file (which has data imported from Oracle 10G Database) one of the fields is a Date Filed which has values like 28-JAN-11 03.25.11.000000000 PM ( Date field is Oracle Time Stamp(6) in Database )

When I am trying to Import the same Excel file from another Oracle 10 G database (for another database/application), I get an error because the data field is not being recognized by Oracle 10G --> Import is being done by ORACLE SQL Developer (Table (field) has TIMESTAMP(6) as the datatype)

How can I import that field ?? For time being I made the TIMESTAMP to VARCHAR2 and its working but I could not convert that to Date field again in C# CODE ( it says not a valid date type).


Excel Date Field Import Problem in Oracle SQL Developer

  

Hi All,

I have an Excel file (which has data imported from Oracle 10G Database) one of the fields is a Date Filed which has values like 28-JAN-11 03.25.11.000000000 PM ( Date field is Oracle Time Stamp(6) in Database )

When I am trying to Import that Excel file from another Oracle 10 G database (for another database/application), I get an error because the data field is not being recognized by Oracle 10G --> Import is being done by ORACLE SQL Developer (Table (field) has TIMESTAMP(6) as the datatype)

How can I import that field ?? For time being I made the TIMESTAMP to VARCHAR2 and its working but I could not convert that to Date field again in C# CODE ( it says not a valid date type).

 


Group By All Columns except the image field

  
Good evening all
 
i have an image in my select fields, and i know that the Group by clause cant take the Image field, i have a query that looks like this


 
SELECT   
K.KIDID,   
K.STUDENTNUMBER,   
KIDNAME,   
KIDLASTNAME ,   
SC.SCHOOLNAME ,   
KIDGRADE ,   
KIDCLASS ,   
SC.SCHOOLID, 
k.TEMP_BARCODE,
PHOTO,
A.ACCOUNTID
,SUM(TRANSACTION_AMOUNT) AS [BALANCE] 
FROM    
KIDS_DETAILS K   
INNER JOIN SCHOOL SC    
ON K.SCHOOLID = SC.SCHOOLID   
INNER JOIN PARENTKID PK    
ON PK.KIDID = K.KIDID
INNER JOIN USERS U
ON U.USERID = K.USERID
INNER JOIN ACCOUNTS A
ON A.USERID = U.USERID
INNER JOIN ACCOUNTRANSATIONS AT
ON 

Inserting new row in GridView in ASP.NET 2.0

  
The GridView was not designed to insert new rows, but there is a way to accomplish this with very little code. This article shows how to do that. The GridView was not designed to insert new rows, but there is a way to accomplish this with very little code.

Built-in Functions - Text and Image Functions in SQL Server

  
Text and image functions operate on TEXT, NTEXT and IMAGE data types. These data types are deprecated with SQL Server 2005 and should be replaced by VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) when possible. Alternatively you can also consider storing large string values using XML data type. Text and image functions are nondeterministic.

Future versions of SQL Server will not support TEXT, NTEXT and IMAGE data types. Columns with TEXT / NTEXT data type do not support commonly used string functions such as LEN, LEFT, RIGHT, etc. Furthermore, due to the large size of TEXT data you''re likely to see performance issues if you store such data in the database. However, at times you can''t help but use the TEXT / NTEXT / IMAGE data types (for example when supporting 3rd party databases when you cannot change the schema) - this is when text and image functions come in handy.

Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend