Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more: , +
Hi all,
I have a table on my Oracle 10g database and one of the coulumn type of the table is LONG datatype. Although I can easily bind this field to Richtextbox and update it, I could not show this field on datagridview. How can be done this? I tried something on VS and PL/SQL procedures, but I have not managed to do.
BR
Posted
Comments
Kschuler 16-May-11 11:09am    
Could you provide more information about your problem. What is happening when you try? Do you get an error? If so what is the message? If not, what is getting displayed?
H.Johnson 17-May-11 9:29am    
No, there is no error. The only problem is that; I can easily bind my datatable to datagridview and show all the column on datagridview except from LONG datagridview. Could you give a sample which provide a datagridview binding to a LONG datatable coulmn please?
BR
H.Johnson 23-May-11 5:35am    
Has anybody to solve this problem?
sairam.bhat 25-May-11 2:49am    
good qstn
sairam.bhat 25-May-11 2:49am    
my +5

Before you bind your long data to the grid , convert the long to string.
This can be done using inline methods when you are binding that particular column value in item template. or Convertion can be done in designer page as well.
 
Share this answer
 
Comments
sairam.bhat 25-May-11 2:50am    
good ans
sairam.bhat 25-May-11 2:50am    
my +5
H.Johnson 27-May-11 7:39am    
Ok, but could you explain a little bit more please? Thanks in advance...
Hello Johnson,
you can use this PL/SQL function to convert LONG field to VARCHAR2.


create or replace function LONG_TO_CHAR(in_table_name varchar,
in_column varchar2, in_id varchar)

return varchar2 as
my_text varchar2(32767);
my_sql varchar2(2000);

begin

sql_cur := 'select '||in_column||' from

'||in_table_name||' where id =

'||chr(39)||in_id||chr(39);

dbms_output.put_line (my_sql);
execute immediate my_sql into my_text;
my_text := substr(my_text, 1, 4000);
return MY_TEXT;

end LONG_TO_CHAR;


And you can simply call this function like that;

Select long_to_char ('MY_TABLE' ,'LONG_TYPE_COLUMN' ,ID) AS RESULT From MY_TABLE

Kindest regards...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900